Skip to content

JSON to YAML & XML Converter

Convert JSON to YAML or XML and back — for config files, APIs and Kubernetes or Docker YAML. Runs in your browser.

About JSON to YAML & XML Converter

This free JSON to YAML converter also turns YAML to JSON, JSON to XML and XML to JSON. Paste a config file, an API response or a Kubernetes or Docker Compose YAML and the result appears as you type, with clear error messages that point to the line and column of a mistake.

XML attributes are shown as keys starting with @ and element text as #text, so you can convert XML to JSON and back without losing them. Choose the indent, sort keys for YAML, set the XML root element and copy or download the result. Everything runs in your browser; nothing is uploaded.

How to use JSON to YAML & XML Converter

  1. Pick the direction, for example JSON → YAML or XML → JSON.
  2. Paste your data — the result updates as you type.
  3. Set the indent; for XML choose the root element name and whether to detect numbers.
  4. Copy or download the result, or use it as the new input to convert back.

Frequently asked questions

How are XML attributes shown in JSON?

Attributes become keys starting with @ (for example "@id": "42") and the text of an element that also has attributes or children goes in "#text". Converting that JSON back to XML turns them into attributes and text again.

Why did a list with one item turn into a single value?

XML has no arrays: repeated elements become a JSON array, but a single element looks the same as a plain value. Check the data shape if you need a list every time.

Is YAML loading safe?

Yes. The converter uses js-yaml’s standard loader, which never runs code; tags such as !!js/function are rejected. Several YAML documents separated by --- become a JSON array.

Are comments kept?

No. JSON has no comments, so YAML and XML comments are dropped when converting to JSON.

How do I convert YAML to JSON?

Choose YAML → JSON, paste your YAML and copy the JSON on the right. Several documents separated by --- become a JSON array.

Is YAML a superset of JSON?

YAML 1.2 accepts almost every JSON document as valid YAML, so JSON is a good starting point. YAML adds comments, multi-line strings and indentation-based structure.

Can I convert JSON to XML for an old SOAP or feed system?

Yes. Choose JSON → XML. Keys become elements, keys starting with @ become attributes, and arrays become repeated elements with the same name.

People also search for

json to yaml · yaml to json · json to xml · xml to json · json to yaml converter · yaml to json converter online · xml to json converter · convert json to xml online · yml to json · json yaml converter

Related tools