JSON ↔ XML Converter
Convert between JSON and XML preserving attributes via @attr and text via #text, with pretty-print of the resulting XML.
Use chaves prefixadas com @ para atributos XML e #text para texto interno.
When the system on the other end only speaks XML
Your API returns JSON, the client's system demands XML, and somebody in between has to translate. It comes up constantly with legacy ERPs, SOAP services and government filing formats. Instead of writing a throwaway script just to check that the structure comes out right, you paste on one side and read the result on the other, in either direction, with a sample button so you can see the convention before risking your real payload.
The translation follows a convention worth understanding before you trust the output: keys starting with an at-sign become element attributes, and the special text key becomes the node's content. So an object with an at-id key and a name field turns into a tag carrying id as an attribute and name as a child. Going the other way, sibling elements sharing a name collapse into an array. That is where the classic trap lives: an element appearing once comes back as an object, and the very same element appearing twice comes back as a list.
Because of that, whatever consumes JSON produced from XML has to normalise before iterating, or the code breaks precisely on the single-item case. Test with a minimal example and again with a repeated element before signing off on the integration contract. The whole conversion runs in the browser with no network calls, so you can paste a staging payload without wondering where it ends up.
Frequently asked questions
How do XML attributes show up in the JSON?
Why do I sometimes get an object and sometimes an array?
Is the pasted content sent to a server?
Related Tools
CSV → JSON Lines
Convert CSV to JSONL (one JSON object per line). Common format in logs, ML pipelines and document databases.
JSON to Java Class
Convert JSON to a Java POJO class with getters/setters and inferred types. Supports nested classes and arrays as List. Everything in your browser.
JSON to TOML
Convert JSON to TOML, the readable config format used by Cargo (Rust), pyproject.toml, Hugo, etc. Supports strings, numbers, booleans, arrays and nested tables. Everything in your browser.
JSON to YAML
Convert JSON data to YAML format.
BSON to JSON (text) Converter
Explains differences between binary BSON and JSON with a type table and textual conversion examples.
Fixed-Width ↔ CSV/JSON Converter
Converts fixed-width text files to CSV, TSV or JSON and back, with automatic column detection, a position map and per-line warnings.