JSON Formatter
JSON Input
Formatted JSON
What is the JSON format?
JSON (JavaScript Object Notation) is a lightweight data-interchange format, easy for humans to read and simple for machines to parse. Created in the early 2000s, it has become the de facto standard for web APIs, configuration files, and semi-structured data storage. Its syntax relies on two universal structures: objects (key/value pairs in curly braces) and arrays (ordered lists in square brackets). Independent of any programming language, JSON is natively supported by JavaScript, Python, PHP, Java, and nearly all modern technologies. A malformed JSON — a missing comma, a forgotten quote, an unclosed brace — causes errors that are hard to spot by eye. This online tool formats, indents, and validates your JSON instantly, highlights syntax errors, and lets you minify your data to reduce its size in production.
What is JSON formatting used for? 8 concrete use cases
Debugging an API response
Paste a raw, minified API response to make it readable and find the data you're looking for.
Validating a configuration file
Check that a config.json or package.json file is syntactically valid before using it.
Minifying JSON for production
Reduce your data size by removing unnecessary whitespace before sending it over the network.
Indenting JSON for documentation
Cleanly format an example payload to include it in technical documentation.
Spotting a syntax error
Quickly identify an extra comma or a missing quote that breaks your JSON.
Comparing two data structures
Indent two JSON files with the same spacing to visually compare their structure.
Preparing a payload for testing
Format a JSON request body before using it in Postman, curl, or an automated test.
Cleaning exported data
Re-indent a database or log export in JSON format to analyze it more easily.
Best practices for working with JSON
- Always use double quotes (
") for keys and strings: JSON does not accept single quotes. - Never leave a comma after the last element of an object or array (trailing comma) — it's a syntax error in strict JSON.
- Minify JSON in production to reduce bandwidth, but keep an indented version for development.
- Always validate JSON received from an external source before parsing it in your application.
- Prefer UTF-8 encoding and properly escape special characters (
\n,\",\\).
Frequently asked questions
What is the difference between formatted and minified JSON?
Why is my JSON invalid?
Does JSON support comments?
Is my JSON data sent to your servers?
Which indentation size should I choose?
What is the difference between a JSON object and an array?
{}. An array is an ordered list of values, delimited by square brackets []. Both can be nested within each other.
Can JSON contain null or boolean values?
true/false), null, object, and array. The values true, false, and null must be written in lowercase and without quotes.
How do I parse JSON in PHP or JavaScript?
JSON.parse(text) to read and JSON.stringify(object) to write. In PHP, use json_decode($text) and json_encode($object). Remember to handle parsing errors (try/catch in JS, json_last_error() in PHP).