How JSON, XML, YAML and TOML are written, what each editor function does, and which conversion to use when.
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.
{
"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
}
]
}
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.
<?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>
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.
# symbol.# 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
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.
# symbol.# 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"
The Format function converts data into a human-readable format. It adds proper indentation and line breaks to make the code easy to read.
Converts minified or unformatted data into a properly indented and readable format.
{"name":"Rahul","age":28,"skills":["JS","Python"],"address":{"city":"Mumbai"}}
{
"name": "Rahul",
"age": 28,
"skills": [
"JS",
"Python"
],
"address": {
"city": "Mumbai"
}
}
The Minify function compresses data by removing unnecessary whitespace, line breaks, and indentation. This reduces the file size and helps in faster network transfer.
Reduces file size to improve loading speed and minimize bandwidth usage.
{
"name": "Rahul Kumar",
"age": 28,
"skills": [
"JavaScript",
"Python",
"React"
]
}
{"name":"Rahul Kumar","age":28,"skills":["JavaScript","Python","React"]}
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.
{name: "Rahul"}// … or /* … */True, False or NoneFor those, the validator shows the exact line and column so you can correct them by hand.
{name: "Rahul", age: 28, // added later
"skills": ["JS", "Python",],
{
"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 ValidateThe Sort function arranges data keys in alphabetical order. This helps keep the data organized and makes it easier to compare.
Organizes data by sorting keys in alphabetical order.
{
"name": "Rahul",
"city": "Mumbai",
"age": 28,
"email": "rahul@example.com",
"country": "India"
}
{
"age": 28,
"city": "Mumbai",
"country": "India",
"email": "rahul@example.com",
"name": "Rahul"
}
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.
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.
{
"employee": {
"name": "Rahul",
"age": 28,
"skills": ["JavaScript", "Python"]
}
}
<?xml version='1.0' encoding='UTF-8'?>
<root>
<employee>
<name>Rahul</name>
<age>28</age>
<skills>JavaScript</skills>
<skills>Python</skills>
</employee>
</root>
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>
{
"name": "Rahul",
"age": "28"
}
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"]}
name: Rahul age: 28 skills: - JS - Python
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.
{
"database": {
"server": "localhost",
"port": 5432
}
}
[database] server = "localhost" port = 5432
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>
name: Keshav skills: - Java - Spring
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.
<config>
<database>
<server>localhost</server>
<port>5432</port>
</database>
</config>
[database] server = "localhost" port = "5432"
address.city.