JSON

JSON has objects (key–value pairs), arrays, strings, numbers, true/false and null — nothing else. Its syntax is strict and small: double-quoted strings, no trailing commas, no comments. That strictness makes it fast and predictable to parse, which is why web APIs use it.

XML

XML is built from elements and attributes, can mix text with nested elements, and supports namespaces and schemas for validation. It is verbose, but well suited to documents and to formats with formal rules, such as RSS feeds, SVG, and the files inside Word and Excel documents.

YAML

YAML uses indentation instead of brackets, allows comments, and is popular for configuration files. YAML 1.2 is almost a superset of JSON. Its flexibility has gotchas: in older YAML 1.1 parsers, unquoted values like no, off or yes become booleans (the “Norway problem”), and inconsistent indentation changes meaning.

Converting between them

JSON to YAML is lossless. YAML to JSON loses comments and expands anchors and aliases. XML to JSON needs conventions for attributes (TextVix writes them as @name), repeated elements (arrays) and mixed text (#text); JSON to XML uses the reverse conventions and turns keys into valid element names.

Try JSON to YAML

Convert JSON into clean, readable YAML for config files.

Open JSON to YAML

Frequently asked questions

Which format should I use for a config file?

YAML if people edit it by hand and comments matter; JSON if it is mostly read and written by programs.

Is it safe to convert an XML file from someone else?

TextVix refuses XML with document type definitions (DTDs), which is how malicious XML pulls in external files or expands into huge output.