YourTools.
简体中文
Back to the catalog
Tools

JSON, YAML and XML converter

Validate, pretty-print or convert between JSON, YAML and XML for their shared subset. External entities and custom tags are rejected.

Process locally

Files stay in this browser session. Closing or clearing releases them.

Add text

Type or paste the text to process

Adjust settings

Optional: Input format, Output format, Indent and more

JSON, YAML and XML converter

Run

Processes in this browser; cancel at any time

Add text first

About this tool

Convert data between JSON, YAML and XML, or validate and pretty-print one of them. Use it to turn a JSON API response into a YAML config, read an XML document as JSON, or check that a YAML file parses before you deploy it.

Conversion works on the data the three formats share: objects, lists, text, numbers, true/false and null, so comments are not carried over. For safety, XML DOCTYPE and entity declarations and custom YAML tags are rejected. Up to 1 MB is processed in your browser and is not uploaded.

How to use it

  1. Paste JSON, YAML or XML, or select “Use example” to load a small JSON object.
  2. Pick the “Input format” and the “Output format”. Choose the same format for both to validate and pretty-print.
  3. Set the “Indent” in spaces, from 0 to 8 (2 by default); 0 puts JSON and XML on one line. Tick “Sort keys” to sort the keys of every object by character code.
  4. Select “Run”, then preview the result and download it as converted.json, converted.yaml or converted.xml.

Formats and limits

Input
Text
Output
JSON, YAML, XML
Size limit
1 MB
Settings
Input format (JSON, YAML, XML); Output format (JSON, YAML, XML); Indent; Sort keys
Privacy
Files stay in the current browser session. No file bytes are uploaded.
Price
Free, no sign-up

Common questions

How is XML mapped to JSON or YAML?

The root element becomes the top-level key, attributes become keys starting with @, and text next to child elements goes under #text. Repeated child elements become a list. XML has no data types, so every value comes out as text, such as “30” rather than 30.

Why is the XML output wrapped in <root>?

XML needs exactly one root element. When the data has a single top-level key, that key becomes the root; otherwise everything is wrapped in <root>. Keys that are not valid XML names, such as ones with spaces or starting with a digit, and lists nested directly in lists cannot be converted to XML.

Why was my YAML rejected?

Custom tags such as !!python/object, duplicate keys in one mapping and files with several documents separated by --- are not accepted, so convert one document per run. Merge keys (<<) are kept as ordinary keys rather than merged.

Are long numbers and comments kept?

Numbers are read as JavaScript numbers, so integers above 9007199254740991 lose precision; keep long IDs as strings. Comments in YAML and XML are dropped, because only the data is converted.

Why are DOCTYPE and entities refused?

XML DOCTYPE and entity declarations can expand or fetch content, so they are rejected. Only the five predefined entities such as &amp; and numeric references such as &#169; are decoded, and processing instructions other than the XML declaration are refused too.