Formatting options
- Indentation: 2 spaces, 4 spaces or a tab for each level.
- Minified: no line breaks or indentation, for the smallest output.
- Self-closing empty tags: write <a/> instead of <a></a> for empty elements.
- Sort keys: order elements alphabetically, which makes files easier to compare.
- XML declaration: include or leave out the opening line.
Pretty or minified?
Indented XML is easier for people to read, review and compare in version control, so it suits configuration files and debugging. Minified XML is smaller, which helps when sending data between systems. The size line under the output shows how many bytes each layout takes.
Whitespace and text
This converter puts text on the same line as its element, so indenting never adds spaces inside your text values. That avoids a common problem where pretty printing changes the data.
Sorted keys for comparing
When you compare two XML files, a different element order shows up as a change. Sorting keys gives both files the same order, so only real differences remain.
For the core options such as the root name and arrays, use the JSON to XML converter. To convert a file, see JSON to XML online. The JSON vs XML guide explains when to choose each format.