OmniDev_

~/tools/json-formatter

JSON Formatter & Validator

Format, minify, and validate JSON instantly — runs entirely in your browser. Zero server calls, zero data sent.

// How to use
1. Paste JSON into the left pane
2. Validation runs automatically
3. Hit Auto-fix if there are errors
4. Choose Format or Minify mode
5. Copy the result from right pane
* Drag & drop .json files also work
// Tree View
- Switch to Tree in output header
- Click ▶ / ▼ to expand / collapse
- Click key name to copy its path
- Use search bar to filter nodes
* e.g.  users[0].profile.name
100% client-side — no data leaves your browser
input.json
0 chars0 lines0.00 KB
Or drag & drop a .json file here
output.json
0 chars0 lines0.00 KB
Formatted output will appear here.

What is JSON?

JSON (JavaScript Object Notation) is a lightweight, human-readable data interchange format derived from JavaScript object syntax. It was popularised by Douglas Crockford in the early 2000s and is now defined by RFC 8259 and ECMA-404. JSON has effectively replaced XML as the dominant format for REST APIs, configuration files, NoSQL databases, and inter-service communication.

JSON supports exactly six data types: string, number, boolean (true/false), null, object (key-value pairs), and array (ordered list). Every other data type must be serialized as one of these six.

JSON Data Types with Examples

JSON supports exactly six data types, and every value in a document must be one of them. Understanding these types is essential because strict parsers will reject anything that doesn't conform — using JavaScript's undefined, Python's None, or a raw Date object will all cause parse failures. Below is a complete breakdown with examples and the common gotchas for each type.

string
"Hello, World!"

Must use double quotes. Supports Unicode and escape sequences (\n, \t, \").

number
42, 3.14, -7, 1e10

Integers and floats. No hex, octal, or Infinity. No leading zeros except 0.x.

boolean
true, false

Must be lowercase. Not True, False, TRUE, or FALSE.

null
null

Represents the intentional absence of a value. Not undefined, None, or nil.

object
{ "key": "value" }

Unordered collection of key-value pairs. Keys must be unique strings.

array
[1, "two", true]

Ordered list of any JSON values. Elements can be mixed types.

Valid JSON Rules & Common Mistakes

JSON has a deliberately minimal and strict syntax. While that makes parsers easy to implement, it also means small mistakes — a trailing comma after the last item, a single-quoted string, or an inline comment — will cause the entire document to fail validation. These are the errors that come up most often when copying JSON from browser DevTools, log files, or configuration templates.

// Invalid JSON

{
  'key': 'value',
  "trailing": true,
  // comment here
  "num": 01,
}

// Valid JSON

{
  "key": "value",
  "trailing": true,
  "num": 1
}

JSON vs XML vs YAML

JSON didn't emerge in a vacuum — it was designed as a lighter alternative to XML and has since been joined by YAML as another human-friendly format. The right choice depends on context: REST APIs favour JSON for its compact size and native browser support, CI/CD pipelines favour YAML for its readability and comment support, and enterprise integrations sometimes still require XML for its schema validation and namespace capabilities.

JSON

+ Universal support, fast parsing, compact

- No comments, strict syntax, no multiline strings

XML

+ Namespaces, schemas (XSD), attributes, comments

- Verbose, complex parsing, heavyweight for APIs

YAML

+ Human-readable, supports comments and multiline

- Indentation-sensitive, parsing quirks, not for APIs

Key Features of This Tool

This formatter was built to handle the real-world messiness of JSON — not just well-formed inputs. Whether you're debugging a malformed API response, exploring a deeply nested structure, or comparing two versions of a config file, every feature here is designed to reduce the time between "something is wrong" and "now I understand it."

Format

Beautify JSON with 2-space indentation and syntax highlighting

Minify

Strip all whitespace for the smallest possible payload size

Validate

Detect and report exact syntax errors with line/column numbers

Auto-fix

Repair trailing commas, single quotes, and other common mistakes

Tree View

Explore deeply nested structures with expand/collapse and path copy

Diff View

Compare two JSON documents side-by-side with highlighted changes