Learn the data formats

How JSON, XML, YAML and TOML are written, what each editor function does, and which conversion to use when.

On this page

{ } JSON - JavaScript Object Notation

JSON is a lightweight data-interchange format that is easy for humans to read and write, and easy for machines to parse and generate. It is the most widely used format for web APIs, mobile app communication, and software configuration files.

Key Features of JSON:

Data Types:

Example:

{
  "name": "Rahul Kumar",
  "age": 28,
  "isStudent": false,
  "skills": ["JavaScript", "Python", "React"],
  "address": {
    "city": "Mumbai",
    "state": "Maharashtra",
    "pincode": 400001
  },
  "projects": [
    {
      "title": "E-commerce Website",
      "status": "completed",
      "year": 2023
    },
    {
      "title": "Mobile App",
      "status": "in-progress",
      "year": 2024
    }
  ]
}

Common Use Cases:

</> XML - Extensible Markup Language

XML is a markup language used to store data in a structured and hierarchical format. It uses tags that look similar to HTML, but it allows you to create your own custom tags.

Key Features:

Syntax Rules:

Example:

<?xml version="1.0" encoding="UTF-8"?>
<employee>
  <name>Rahul Kumar</name>
  <age>28</age>
  <department id="IT-001">
    <name>Information Technology</name>
    <location>Mumbai</location>
  </department>
  <skills>
    <skill level="expert">JavaScript</skill>
    <skill level="intermediate">Python</skill>
    <skill level="expert">React</skill>
  </skills>
  <projects>
    <project status="completed">
      <title>E-commerce Website</title>
      <year>2023</year>
    </project>
  </projects>
</employee>

Common Use Cases:

📄 YAML - YAML Ain't Markup Language

YAML is a human-friendly data serialization format that is widely used for configuration files. It uses indentation to define structure, so there is no need for brackets or braces.

Key Features:

Syntax Features:

Example:

# Employee Configuration
name: Rahul Kumar
age: 28
isStudent: false

# Skills List
skills:
  - JavaScript
  - Python
  - React

# Nested Address Object
address:
  city: Mumbai
  state: Maharashtra
  pincode: 400001

# Array of Objects
projects:
  - title: E-commerce Website
    status: completed
    year: 2023
    technologies:
      - React
      - Node.js
      - MongoDB

  - title: Mobile App
    status: in-progress
    year: 2024
    technologies:
      - React Native
      - Firebase

Common Use Cases:

⚙️ TOML - Tom's Obvious Minimal Language

TOML is a configuration file format inspired by INI files. It is human-readable and designed to be easy and unambiguous to parse. TOML is very popular in Rust and Python projects.

Key Features:

Data Types:

Example:

# Employee Configuration File

name = "Rahul Kumar"
age = 28
isStudent = false

# Skills Array
skills = ["JavaScript", "Python", "React"]

# Address Table
[address]
city = "Mumbai"
state = "Maharashtra"
pincode = 400001

# Array of Tables - Projects
[[projects]]
title = "E-commerce Website"
status = "completed"
year = 2023
technologies = ["React", "Node.js", "MongoDB"]

[[projects]]
title = "Mobile App"
status = "in-progress"
year = 2024
technologies = ["React Native", "Firebase"]

# Nested Table Example
[database]
server = "192.168.1.1"
port = 5432
connection_max = 5000
enabled = true

[database.credentials]
username = "admin"
password = "secure_password"

Common Use Cases:

🎨 Format Function

The Format function converts data into a human-readable format. It adds proper indentation and line breaks to make the code easy to read.

Purpose:

Converts minified or unformatted data into a properly indented and readable format.

How it Works:

  • Adds whitespace and line breaks
  • Maintains proper indentation levels
  • Organizes nested structures in a clear and visual way

Before Format (Minified):

{"name":"Rahul","age":28,"skills":["JS","Python"],"address":{"city":"Mumbai"}}

After Format:

{
  "name": "Rahul",
  "age": 28,
  "skills": [
    "JS",
    "Python"
  ],
  "address": {
    "city": "Mumbai"
  }
}
Beautify Pretty Print Indent

📦 Minify Function

The Minify function compresses data by removing unnecessary whitespace, line breaks, and indentation. This reduces the file size and helps in faster network transfer.

Purpose:

Reduces file size to improve loading speed and minimize bandwidth usage.

How it Works:

  • Removes extra whitespace
  • Eliminates line breaks and indentation
  • Reduces size while keeping the data unchanged

Before Minify (Formatted):

{
  "name": "Rahul Kumar",
  "age": 28,
  "skills": [
    "JavaScript",
    "Python",
    "React"
  ]
}

After Minify:

{"name":"Rahul Kumar","age":28,"skills":["JavaScript","Python","React"]}

Benefits:

Compress Optimize Reduce Size

🔧 Repair Function

Repair takes JSON that won't parse and fixes the mistakes that most often come from hand-editing or from copying JavaScript code. It is available for JSON in the formatter.

What Repair fixes:

  • Keys without quotes, such as {name: "Rahul"}
  • Trailing commas after the last item in an object or array
  • Comments written as // … or /* … */
  • Brackets or braces that were never closed

What it doesn't fix:

  • Single quotes around keys or strings
  • Missing commas between properties
  • Python values like True, False or None

For those, the validator shows the exact line and column so you can correct them by hand.

Example

Before Repair:

{name: "Rahul", age: 28, // added later
 "skills": ["JS", "Python",],

After Repair:

{
  "name": "Rahul",
  "age": 28,
  "skills": [
    "JS",
    "Python"
  ]
}

The keys got their quotes, the comment and the trailing comma are gone, and the missing closing brace was added.

Fix Errors Auto-correct Validate

🔤 Sort JSON/XML Function

The Sort function arranges data keys in alphabetical order. This helps keep the data organized and makes it easier to compare.

Purpose:

Organizes data by sorting keys in alphabetical order.

Features:

  • Sorts keys alphabetically
  • Also sorts keys inside nested objects
  • Keeps the order of array items (only keys are sorted)
  • Makes data comparison easier
  • Sort XML does the same for child elements

Before Sort:

{
  "name": "Rahul",
  "city": "Mumbai",
  "age": 28,
  "email": "rahul@example.com",
  "country": "India"
}

After Sort:

{
  "age": 28,
  "city": "Mumbai",
  "country": "India",
  "email": "rahul@example.com",
  "name": "Rahul"
}

Use Cases:

Alphabetical Organize Compare

🔄 Format Conversion Functions

Conversions take the content of the editor and show the result in the right-hand panel. Your original stays unchanged on the left. The examples below show the exact output of each conversion.

1. JSON to XML

Each key becomes an element and each value becomes the element's text. Arrays turn into the same element repeated once per item, because XML has no separate list syntax. The whole document is wrapped in a <root> element, since XML needs exactly one root, and an XML declaration is added at the top.

JSON input:
{
  "employee": {
    "name": "Rahul",
    "age": 28,
    "skills": ["JavaScript", "Python"]
  }
}
XML output:
<?xml version='1.0' encoding='UTF-8'?>
<root>
  <employee>
    <name>Rahul</name>
    <age>28</age>
    <skills>JavaScript</skills>
    <skills>Python</skills>
  </employee>
</root>

2. XML to JSON

Child elements become keys and repeated elements become arrays. The root element itself becomes the outer object, so its name does not appear in the output. All values are strings, because XML text has no types.

XML input:
<person>
  <name>Rahul</name>
  <age>28</age>
</person>
JSON output:
{
  "name": "Rahul",
  "age": "28"
}

3. JSON to YAML

Objects become indented blocks and arrays become lists with a dash per item. Quotes are only added where YAML needs them. For example, text that looks like a number or a yes/no value keeps its quotes, so it stays text.

JSON input:
{"name": "Rahul", "age": 28, "skills": ["JS", "Python"]}
YAML output:
name: Rahul
age: 28
skills:
- JS
- Python

4. JSON to TOML

Top-level values become key = value lines, nested objects become [tables], and arrays of objects become repeated [[tables]]. TOML has no null, so keys with a null value are left out.

JSON input:
{
  "database": {
    "server": "localhost",
    "port": 5432
  }
}
TOML output:
[database]
server = "localhost"
port = 5432

5. XML to YAML

Works like XML to JSON: repeated elements become a list and the root element becomes the top level.

XML input:
<user>
  <name>Keshav</name>
  <skills>Java</skills>
  <skills>Spring</skills>
</user>
YAML output:
name: Keshav
skills:
- Java
- Spring

6. XML to TOML

Useful when moving settings from an older XML config to a TOML file. Nested elements become tables. Values come out as strings, again because XML text has no types, so change "5432" to 5432 by hand where a number is expected.

XML input:
<config>
  <database>
    <server>localhost</server>
    <port>5432</port>
  </database>
</config>
TOML output:
[database]
server = "localhost"
port = "5432"

Other conversions

Transform Convert Migrate Interchange

💡 Pro Tips & Best Practices

JSON Best Practices:

XML Best Practices:

YAML Best Practices:

TOML Best Practices: