JSON Formatter & Validator โ Format, Minify, and Explore JSON
Format, prettify, minify, and validate JSON instantly. Explore parsed JSON in an interactive tree view. Sort keys, copy, download โ all in your browser.
What Is JSON?
JSON (JavaScript Object Notation) 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 built on two structures: a collection of name/value pairs (objects, written as { "key": "value" }) and an ordered list of values (arrays, written as ["a", "b", "c"]). JSON supports six data types: strings, numbers, booleans (true/false), null, objects, and arrays.
JSON has become the universal language of APIs. REST APIs, GraphQL responses, webhook payloads, browser localStorage, configuration files (package.json, tsconfig.json), and cloud service schemas all use JSON. Understanding how to quickly read and validate JSON is an essential skill for every developer.
Common JSON Errors and How to Fix Them
The JSON specification is strict โ a single misplaced character makes the entire document invalid. The most common errors are:
- Trailing commas โ
{"a": 1,}is invalid JSON (though valid in JavaScript). Remove the comma after the last element. - Single quotes โ JSON requires double quotes for both keys and string values.
{'a': 1}is invalid. - Unquoted keys โ
{a: 1}is valid JavaScript but not valid JSON. Keys must be quoted strings. - Undefined and functions โ JSON does not support
undefined, functions, orNaN. Replace withnullor a string representation. - Unescaped special characters โ Newlines, tabs, and quotes inside strings must be escaped:
"line1\nline2".
How to Format and Validate JSON
- Paste or type your JSON into the input editor. The validator runs automatically and shows a green banner for valid JSON, or a red banner with the exact error message for invalid JSON.
- Click Format / Prettify to produce indented, human-readable JSON in the output panel. Choose 2 spaces, 4 spaces, or tabs from the Indent dropdown.
- Click Minify to collapse the JSON to a single line โ ideal for reducing payload size in API requests.
- Switch to Tree view to explore the structure interactively. Click any object or array to expand or collapse it.
FAQ
Frequently Asked Questions
Related Tools
- Encode and decode Base64 strings found in JSON payloads with our Base64 Encoder / Decoder.
- Decode percent-encoded URL strings from JSON API responses with our URL Encoder / Decoder.
- Convert Unix timestamps found in JSON with our Unix Timestamp Converter.