This tool formats and validates JSON (JavaScript Object Notation) entirely in your browser, so you can quickly turn messy or minified data into clean, readable text and catch syntax errors before they cause problems in your code, API calls or configuration files. Paste any raw or minified JSON into the input box, choose an indentation size of 2 spaces, 4 spaces or a tab, then click Format / Validate to pretty-print it with proper line breaks and indentation, or click Minify to strip all whitespace down to the smallest possible string. The status bar tells you straight away whether your JSON is valid, and if it is not, it reports the exact error message from the browser's parser, including the position of the first invalid character, so you can fix issues like trailing commas, single quotes or missing brackets. Below that, a statistics panel shows the validation status, the number of top-level keys or array items, the input size and the formatted output size in characters, giving you a quick sense of how your data is structured. A Copy Output button lets you grab the result straight to your clipboard. Because everything runs client-side using the browser's built-in JSON.parse() and JSON.stringify(), no data you paste is ever sent to a server, stored or logged, which makes this suitable for JSON containing sensitive information such as API keys or tokens.
JSON (JavaScript Object Notation) is a lightweight text format for exchanging structured data. It is defined by ECMA-404 and RFC 8259. The format consists of two structures: objects (collections of key-value pairs enclosed in curly braces) and arrays (ordered lists enclosed in square brackets). Keys must be strings enclosed in double quotes, and values can be strings, numbers, booleans (true / false), null, nested objects, or arrays.
Formatting (also called pretty-printing or beautifying) adds newlines and indentation to make JSON easier to read. Minifying removes all whitespace to produce the smallest possible string, which is useful for reducing file sizes in APIs and config files. This tool uses the browser's native JSON.parse() to validate and then JSON.stringify() with an indent argument to produce formatted output.
Given the following minified JSON input (the default in this tool):
With 2-space indentation selected, the formatter produces:
The input has 4 top-level keys, an input size of 60 characters, and a formatted size of 95 characters.
{"a":1,} is invalid. Remove the comma after the last key-value pair or array element.{'name':'Alice'} is invalid. All keys and string values must use double quotes.{name:"Alice"} is invalid. Keys must always be quoted strings.undefined, NaN, and Infinity are not valid JSON values. Use null instead, or convert numbers to strings.// or /* */ before parsing.\t or \n.JSON is the default data exchange format for REST APIs, web browser storage (localStorage, sessionStorage), and configuration files for Node.js projects and many modern tools. For configuration files that benefit from comments, YAML or TOML are popular alternatives. For binary efficiency over the wire, formats such as MessagePack or Protocol Buffers are used. For human-authored config where schema validation matters, JSON Schema can be layered on top of JSON.
Method: Validation and formatting use the browser's built-in JSON.parse() (ECMA-404 / RFC 8259) and JSON.stringify(indent). No server-side processing. Input size is measured in UTF-16 code units (same as JavaScript's String.length).
This tool processes all data locally in your browser. No input is transmitted or stored anywhere. Suitable for sensitive JSON content such as API keys, tokens, and configuration data.
If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.
Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.
Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.
All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.
Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.
Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.
Calculate.co.nz is hosted in Auckland via SiteHost new Zealand.
All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.
About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use
Reviewed and maintained. Last reviewed 2026-07-02 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.
© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.