How to convert xml to json with multiple U.Mode?
See original GitHub issueSuch as
String json = U.xmlToJson(xml, U.Mode.REPLACE_SELF_CLOSING_WITH_NULL, U.Mode.REPLACE_EMPTY_VALUE_WITH_NULL);
which can replace self closing with null and also replace empty value with null
Reversely, when convert json to xml
String xml = U.jsonToXml(json, U.Mode.REPLACE_NULL_WITH_EMPTY_VALUE, U.Mode.REPLACE_EMPTY_VALUE_WITH_SELF_CLOSING);
At the same time, I hope to add some new Mode like:
// replace <aaa></aaa> to "aaa": ""
U.xmlToJson(xml, U.Mode.REPLACE_EMPTY_TAG_WITH_EMPTY_VALUE);
and reversely
// replace "a": "" to <aaa></aaa>
U.jsonToXml(json, U.Mode.REPLACE_EMPTY_VALUE_WITH_EMPTY_TAG);
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
XML to JSON
Select this option to convert number, boolean, or null elements in the incoming XML document to JSON primitive types. This option is selected...
Read more >XML to JSON Converter - Oxygen XML Editor
Converting XML to JSON in Oxygen · Select the XML to JSON action from the Tools > JSON Tools menu. · Choose or...
Read more >How to convert XML to JSON? - ReqBin
The XML to JSON converter lets you convert XML data strings to JSON objects. ... Each XML document can contain multiple objects that...
Read more >XML to JSON Conversion Issue - Stack Overflow
try entering 1234 as a value for any element in the xsd. You will notice that the converted json for that element becomes...
Read more >Converting XML to JSON using Python - STechies
Here, you have to first import the xmltodict as well as the json module. Next, create an XML structure and put all of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dejavuhuh I added new mode
REPLACE_EMPTY_STRING_WITH_EMPTY_VALUE
to theU.jsonToXml(json)
method.Hi @dejavuhuh,
The new mode
REPLACE_EMPTY_TAG_WITH_NULL
replaces emply tag and self closing tag with null.