I am trying to load the following yaml:
yaml_string = """
key:
- [HELLO]
- another string
- another
"""
yaml.safe_load(yaml_string) # returns {"key": [["HELLLO"], "another_string", "another"}
and the result is a list containing the HELLO string. I wan to load this a string value that is
type(yaml.save_load(yaml_string).get("key")[0])
<class 'str'>
Since yaml describes some sort of commnads that are formatted this way, it is necessary to be read as strings and not as sequences. Basically I want to be able to read strings that start and end with brackets. As explained to the comment underneath, unfortunatelly it is not possible to add "
since the yaml files were created by a Java app using Jackson which didn't have a problem turning yaml into an object and treating entries that start and end with brackets as strings. The files are to many for users to start adding quotes.
Is this possible?
EDIT: Added a more complete example