You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Raised at #16 (comment) there are some edge cases when mapping JSON with arrays to XML. In the end the handling is arbitrary convention but it should be consistent. Some examples:
$ echo '[]' | oq -o xml .
<root/>
makes sense
$ echo '["x",{}]' | oq -o xml .
<root><item>x</item><item/></root>
this surprised me. Why support arrays on the root level at all?
$ echo '{"a":[],"b":{},"c":null}' | oq -o xml .
<root><b/><c/></root>
why no <a/>?
$ echo '{"a":[[]]}' | oq -o xml .
<root><a/></root>
wtf?
$ echo '{"x":[1,[2,[3]]]}' | oq . -o xml
<root>
<x>1</x>
<x>
<item>2</item>
<item>
<item>3</item>
</item>
</x>
</root>
Ok, there is some logic here
The text was updated successfully, but these errors were encountered:
nichtich
changed the title
Clarify mapping of arrays to
Clarify mapping of arrays to XML
Jul 18, 2019
The third case there is probably since the array is empty, so it doesn't add any elements. Would just want to emit an empty tag in that case. Which would make sense why the fourth has the empty tag since it has an element.
Nested array stuff like this should get better in my refactor.
Raised at #16 (comment) there are some edge cases when mapping JSON with arrays to XML. In the end the handling is arbitrary convention but it should be consistent. Some examples:
makes sense
this surprised me. Why support arrays on the root level at all?
why no
<a/>
?wtf?
Ok, there is some logic here
The text was updated successfully, but these errors were encountered: