About this tool
Direct comparison between six widely used data serialization formats: JSON, YAML, XML, TOML, INI and CSV. For each one you get side by side syntax, strengths, weaknesses and the context in which it makes sense to pick it. Useful for deciding the configuration format of a new application, quickly getting up to speed on a format you have not used before, or backing a technical decision with concrete reasoning.
How to use
- Read the comparison table for an overview of each format's traits.
- Compare the examples side by side. They all represent the same object to make comparison easier.
- Decide based on context. Some formats are better for hand edited configuration, others for exchange between systems.
Frequently asked questions
- Which format is the most used today?
- JSON dominates the web, no question. It is the default for REST APIs and frontend configuration. YAML rules DevOps and infrastructure, especially CI pipelines and container definitions. XML still holds ground in enterprise environments and formats with complex document structure. TOML grew significantly in developer tooling ecosystems. CSV remains the standard for tabular data.
- Can I convert between formats?
- Yes, in most cases. JSON, YAML and TOML have similar data models and conversion between them is almost direct. XML is more complex because of attributes and mixed content, but there are common mappings. CSV only represents tables, so converting to hierarchical or from hierarchical to CSV requires decisions on how to flatten the structure.
- Why is YAML so problematic?
- It has a much larger specification than it looks. Some keywords ("yes", "no", "on", "off") are interpreted as booleans, numbers with leading zeros may be read as octal, and indentation with spaces or tabs causes silent errors. Newer versions (YAML 1.2) addressed some of these, but you need to be careful about the parser's strict mode.
- Do JSON5 and JSONC solve JSON's lack of comments?
- Yes, they are JSON variants that add comments and some extra flexibility (trailing commas, unquoted keys). They are not universal standards but are supported in specific environments like code editors. For exchange between systems, stick to plain JSON for guaranteed compatibility.
- When should I pick TOML over YAML?
- TOML is better when you want clean syntax for configuration without YAML's indentation traps. For project configuration files with medium structure, TOML tends to be less error prone. YAML is better for very deep structures or when you need internal references and advanced features.