Developer tool
XML to JSON converter
Turn XML from feeds, SOAP APIs or config files into JSON you can use in code. Need the other way? Use JSON to XML.
Advertisement
JSON
Advertisement
How XML becomes JSON
- Each tag becomes a key. A tag with only text becomes a simple value:
<name>Asha</name>→"name": "Asha". - Attributes get an
@in front:id="7"→"@id": "7". - When a tag repeats, its values are collected into an array.
- Text next to child tags or attributes goes in
"#text". - By default every value stays a string, so codes like
007aren't changed. Tick the option to turn plain numbers and true/false into real JSON values.
A tag appears once here but many times in other files. Will it be an array?
Only when it repeats in this file. If your code always expects an array, wrap single values in an array after converting.
Are comments kept?
No. JSON has no comments, so XML comments are dropped. CDATA text is kept as normal text.
Advertisement