Hi,
when a xml document contains several instances of 2 different kinds of XML tags , xml2json regroups them in 2 different json arrays, ignoring the original sequence of the xml document.
Example:
<xml>
<tag1 id="1"/>
<tag1 id="2"/>
<tag2 id="1"/>
<tag2 id="2"/>
<tag1 id="3"/>
</xml>
gives this result:
{"xml":{
"tag1":[{"@id":"1"},{"@id":"2"},{"@id":"3"}],
"tag2":[{"@id":"1"},{"@id":"2"}]
}
which is understandable because the standard says that the names within an object SHOULD be unique.
To conserve this sequential information in the resulting json, I was expecting something like:
{"xml":{
"tag1[0]":[{"@id":"1"},{"@id":"2"}],
"tag2":[{"@id":"1"},{"@id":"2"}],
"tag1[1]":{"@id":"3"}
}
But someone may have a better approach to propose.
Could it be considered as an optional feature ?
thanks
Hi,
when a xml document contains several instances of 2 different kinds of XML tags , xml2json regroups them in 2 different json arrays, ignoring the original sequence of the xml document.
Example:
gives this result:
{"xml":{ "tag1":[{"@id":"1"},{"@id":"2"},{"@id":"3"}], "tag2":[{"@id":"1"},{"@id":"2"}] }which is understandable because the standard says that the names within an object SHOULD be unique.
To conserve this sequential information in the resulting json, I was expecting something like:
{"xml":{ "tag1[0]":[{"@id":"1"},{"@id":"2"}], "tag2":[{"@id":"1"},{"@id":"2"}], "tag1[1]":{"@id":"3"} }But someone may have a better approach to propose.
Could it be considered as an optional feature ?
thanks