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
{{ message }}
This repository was archived by the owner on Jan 7, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 7, 2021. It is now read-only.
When I have this XML <foo attr=\"value\">bar<subnode val=\"test\" >glass</subnode></foo>
I would expect this JSON
{"foo":{"attr":"value","$t":"bar","subnode":{"val":"test","$t":"glass"}}} but I get:
{"foo":{"attr":"value","subnode":{"val":"test","$t":"glass"}}}
Losing the "$t":"bar"
I found in the code of xml2json.js -> endElement(name) ... that you delete the textNodeName element of the currentObject. Why would you do this? This removes all text elements but the one on the deepest child node.
Activity
corroded commentedon May 24, 2018
Also encountering this issue. It looks like it was added here: 8538475
to fix some spaces disappearing. It does not seem to be by design but a side effect.
@denghauser just curious, how did you address this on your end?
javadev commentedon Dec 5, 2018
may be converted to:
{ "foo": { "-attr": "value", "#text": "bar", "subnode": { "-val": "test", "#text": "glass" } }, "#omit-xml-declaration": "yes" }