Open tools · 0

About

JSON, YAML, XML & TOML

Paste a file, open one or drop it on the window, and it is converted as you type, either way between JSON, YAML, XML and TOML. Three things the usual converters do not do: numbers keep the literal they were written with, comments survive wherever the target has a syntax for them, and every value YAML 1.1 reads differently from YAML 1.2 is named.

What it does

  • Any of the four to any other, with From and To chosen and Swap to turn the result around.
  • Numbers as written: a 20-digit id stays exact, and 1.0 stays 1.0.
  • Comments carried into YAML, TOML and XML; where the target has none, the count of what was dropped is shown.
  • The Norway problem named: NO, ON or an unquoted date, each with its line, and YAML written quoted so both versions agree.
  • Several YAML documents taken together; anchors, aliases and merge keys resolved and counted; key order kept, or sorted.
  • What a format cannot hold reported, never dropped in silence: TOML has no null, and XML has only text.
  • XML by one stated rule, both ways: an attribute is @name, text is #text, and repeated tags are a list.
  • A file that is not what From says offers to be read as what it is; a mistake is placed by line and column.

How to use it

  1. Paste or drop the file; From is set from its name or its content.
  2. Pick To.
  3. Read the notes about what changed or could not be carried.
  4. Copy the result, or download it named after the source with the new extension.

What it does not do

  • HCL, INI, properties files or code: the long tail of the big conversion sites.
  • CSV: the CSV Viewer & Editor reads and writes it with types, dates and code pages, so this tool leaves it there.
  • JSON Schema and JSONPath: different jobs from converting.
  • Comments turned into _comment keys in JSON: that changes the data, and the program reading it finds keys it never had.
  • Loading from a URL or saving online: the page is not allowed to reach other sites.

Questions

What is the Norway problem?

In YAML 1.1, which PyYAML, Ansible and many Kubernetes tools still follow, the unquoted country code NO is false, ON is true and 2024-01-01 is a date. In YAML 1.2 they are text. The converter names every such value and quotes it on the way out.

Why did another converter turn 1.0 into 1?

It read the number into a floating-point value and printed it back. This one keeps the text of every number.

How does XML become JSON?

Attributes become @name keys, text becomes #text, repeated child tags become a list, and the root element keeps its name. The same rule runs backwards.

What happens to a null on the way to TOML?

TOML has no null, so the key is left out, and you are told how many were.

Everything here runs in your browser. Nothing you type, paste or open is uploaded, and there is no account and no queue. How that works.

For one job

  • JSON to YAML: JSON written as YAML that every YAML reader takes the same way.
  • YAML to JSON: YAML as JSON, anchors expanded and several documents in one array.
  • JSON to XML: JSON written as one well-formed XML document, @ keys as attributes.
  • XML to JSON: XML read into JSON by one rule: @ for attributes, arrays for repeated tags.
  • JSON to TOML: JSON written as TOML tables, with what TOML cannot hold reported.
  • TOML to JSON: A TOML file as JSON, tables nested and dates as strings.

Often used with

More in Converters

  • Unit Converter: Convert length, weight, temperature, volume, area, speed, data size and nine more quantities, both ways, with the formula.
  • Base64 Encode & Decode: Encode text or files to Base64 and decode it back: URL-safe, MIME line breaks, data URIs, and images you can preview.

All toolsAbout utilbrewPrivacy