XML to JSON

Converts XML to JSON: attributes become fields with "@", repeated tags become arrays, element text goes into "#text".

Paste XML or open a file. Attributes become fields prefixed with "@", an element's text becomes a "#text" field, and repeated tags become an array. An empty element produces null.

All values are stored as strings. A phone number like 0079161234567 keeps its leading zeros, and a 20-digit account number keeps every digit: a number can only hold 15 significant digits, and everything after that would turn into zeros.

An element that mixes text with tags is converted into a list: first the text before the tag, then the tag itself, then the remaining text. The order is preserved, so converting back returns the same element.

Comments, processing instructions, and the declaration on the first line are markup, not data. The content of a CDATA section becomes plain text. The file is read as UTF-8, and if it is not in that encoding, as windows-1251.

Rate this tool

Help us get better

Other tools