How do I format messy JSON?
Raw JSON from an API or a debug log often arrives as a single, unformatted line. Reading it without indentation is painful for anything beyond the simplest structure.
Formatted JSON uses two or four spaces of indentation per level, with each key-value pair on its own line:
{"user":{"id":42,"name":"Alice","roles":["admin","editor"]}}
becomes:
{
"user": {
"id": 42,
"name": "Alice",
"roles": ["admin", "editor"]
}
}
The JSON Formatter also validates the input — if your JSON has a syntax error (missing comma, trailing comma, unquoted key), it pinpoints the problem rather than silently failing.
How do I convert XML to JSON?
XML and JSON represent the same kinds of structured data but with different syntax. XML uses nested tags; JSON uses nested objects and arrays. Converting between them requires decisions about how to handle attributes, text content, and repeated elements.
A typical XML-to-JSON mapping:
- XML element → JSON object key
- XML attribute → JSON key with
@prefix (or merged into the object) - Repeated XML elements → JSON array
Example:
<user id="42"><name>Alice</name></user>
becomes:
{"user": {"@id": "42", "name": "Alice"}}
The XML to JSON Converter handles nested structures, attributes, and repeated elements — paste your XML and get clean JSON ready to use in code.
How do I convert TOML to JSON?
TOML (Tom's Obvious, Minimal Language) is a configuration file format designed for human readability. It is used by Rust projects (Cargo.toml), Python packaging (pyproject.toml), and many CLI tools. When you need to process a TOML config programmatically in a context that expects JSON, conversion is the straightforward path.
TOML maps naturally to JSON:
- TOML tables → JSON objects
- TOML arrays → JSON arrays
- TOML inline tables → JSON objects
The TOML to JSON Converter validates TOML syntax and produces formatted JSON — useful for debugging configs or feeding TOML data into a JSON-based pipeline.
How do I compare two JSON objects to find differences?
When you have two versions of a JSON structure — before and after an API change, two config files, or a test fixture and an actual response — finding the differences by eye is unreliable for anything beyond a few keys.
A structural diff shows:
- Keys present in one but not the other
- Keys present in both but with different values
- Type changes (a string that became a number, etc.)
The JSON Comparator takes two JSON inputs and returns a diff highlighting additions, deletions, and changes — with nested path references so you can find the difference immediately.
Summary
JSON, XML, and TOML all model structured data, just with different syntax rules and ecosystems. The four tools above cover the most common day-to-day tasks: cleaning up JSON for reading, translating between XML and JSON, converting TOML configs to JSON, and pinpointing differences between JSON structures.