Nested array string values don't overwrite nested key/value pairs created by scoped arrays
minikomi opened this issue · 3 comments
minikomi commented
Test case:
[a.b]
d:e
[]
[a.b]
* c
[]
abstrctn commented
This is an open question for users: whether arrays should be "sticky" if they're opened multiple times. At the moment, both simple and complex arrays can be reopened:
[complex]
key: value
[]
[complex]
key: value
[]
[simple]
* value
[]
[simple]
* value
[]
{
"complex": [{"key": "value"}, {"key": "value"}],
"simple": ["value", "value"]
}
Since an arrays type is decided by whether a key: value
or a * value
is found first, I think that if you reopen an array, it makes sense in a way to continue to parse only either complex or simple values. (Inside a complex array, * value
isn't treated as an array element, and vice versa.)
@minikomi, @archietse - which do you think would be most intuitive for users?
minikomi commented
Yep, I didn't realize the key / simple text sticky rule while I was playing about with this. I think once you know the rule, the current behavior makes sense.