Submit an extension

↑↓ move · ↵ open · Tab filter · Esc close

Free tool · Developer utilities

JSON Formatter, Validator and Viewer

Paste JSON or open a file. Format it, minify it, find the exact line and column of any error, and browse it as a tree. Nothing leaves your browser.

  • Free, no sign-up
  • Runs in your browser
  • Works on mobile

Press Ctrl + Enter (⌘ + Enter on a Mac) to format. Files up to 50 MB; nothing is uploaded.

Indent

Waiting for input

Paste or open some JSON, then press Format. The validator checks it as you type.

Input size
–
Keys
–
Values
–
Objects / arrays
–
Max depth
–
Output view
Formatted JSON appears here, with syntax highlighting. Switch to Tree to browse it as collapsible nodes and copy the path of any value.

A JSON formatter turns compact or messy JSON into indented, readable text and checks that it is valid. This one runs entirely in your browser: paste or drop a file, press Format, and you get highlighted output, a collapsible tree with copyable paths, and any error pinned to its line and column with a fix.

Last checked · Independent, not affiliated with Google

Your data Your JSON never leaves this page. Parsing, formatting, the tree view, copy and download all run in your browser with JavaScript; nothing is uploaded, logged or stored. The tool only saves your indent, sort and show-types preferences in this browser's local storage, never the JSON itself.

How to use the JSON Formatter & Viewer

  1. Add your JSON

    Paste it into the input box, drop a .json file onto it, or press Open .json file. Press Sample JSON to try it first.

  2. Pick the indent

    Choose 2 spaces, 4 spaces or a tab. Tick Sort keys A–Z if you want object keys in alphabetical order.

  3. Format, minify or validate

    Press Format (or Ctrl/⌘ + Enter) to pretty print, Minify to strip whitespace, or Validate to check without changing anything.

  4. Fix any error

    If the JSON is invalid you get the line, column, a caret under the problem and a plain-English fix. Jump to the error selects it in the input.

  5. Browse the tree

    Switch the output to Tree to expand and collapse nodes. Click a key or index to copy its path, such as $.items[3].name.

  6. Copy or download

    Copy the result to the clipboard or download it as a .json file. Use as input moves the output back into the box.

What does a JSON formatter do?

A JSON formatter reads JSON text, checks it against the grammar, and writes it back out with consistent indentation and line breaks. The data stays the same; only the whitespace changes, so a 40 KB API response on one line becomes something you can scan and debug.

People also call this a JSON beautifier or a tool to pretty print JSON. The terms mean the same job. Most tools add a JSON validator on top, because formatting is impossible until the text parses. That is why search results mix "JSON formatter and validator" and "JSON validator and formatter": it is one tool with two outputs.

Formatting adds line breaks and indentation. Keys, values and their order stay exactly the same.

This page adds four things most online tools skip. It keeps every number and string exactly as written, it reports errors with a caret and a suggested fix, it shows a lazy tree view that stays fast on big files, and it flags duplicate keys and numbers that JavaScript would round.

How does the JSON validator find errors?

The validator walks the text one character at a time and stops at the first character that breaks the JSON grammar in RFC 8259. It reports the line and column itself, so the result is the same in every browser, and it explains the usual cause.

Browser error messages differ. Chrome, Firefox and Safari each word JSON.parse failures their own way, and some only give a character offset. Counting to character 4,812 by hand is no fun, so this page does it for you and shows the broken line with a ^ under the problem.

The JSON errors people hit most, and how to fix them
What you seeWhy it's invalidFix
[1, 2, 3,]Trailing commas are not allowedDelete the last comma
{'name': 'Ada'}Single quotes are JavaScript, not JSONUse double quotes for keys and strings
{name: "Ada"}Property names must be quotedWrite "name"
// commentJSON has no comment syntaxRemove the comment, or move it into a field
"a": 1 "b": 2Missing comma between membersAdd a comma after 1
undefined, NaN, TrueNot JSON valuesUse null, a number, or lowercase true
007Leading zeros are not allowedWrite 7, or keep codes as strings
A real line break inside quotesControl characters must be escapedWrite \n instead

How do I use the JSON viewer tree?

Switch the output to Tree to use it as a JSON viewer. Objects show their key count and arrays show their length, so you can see the shape of a response before opening anything.

  • Expand and collapse: click a row, or use Expand all and Collapse all. Expand all stops after a few thousand nodes so a huge file can't lock the tab.
  • Copy a path: click any key or array index to copy its JSONPath-style path, like $.items[3].name or $["free over"] for keys with spaces. Paste it into code, a jq filter or a test.
  • Show types: tick it to label every value as string, number, boolean, null, object or array. Handy when an API returns "42" where you expected 42.
  • Big arrays: children load 200 at a time with a Show next button, so a 100,000-item array opens instantly.

The tree shows keys in their original order, even if you sort keys in the text output. That makes it a faithful JSON object formatter view of what the server actually sent.

JSON beautifier or JSON minify: which do you need?

Beautify when a person will read the JSON; minify when a program will. Minified JSON drops every space and line break outside strings, which makes payloads and config values smaller but unreadable.

Pretty print JSON vs minify JSON
Pretty print (Format)Minify
Best forReading, debugging, code review, docsAPI payloads, storage, environment variables
WhitespaceIndents with 2 spaces, 4 spaces or tabsNone outside strings
SizeLargerSmallest possible text
Data changed?NoNo

In code, JSON.stringify(value, null, 2) pretty prints and JSON.stringify(value) minifies. Both work on a parsed value, which is where precision can slip (see the next section). The Format and Minify buttons here work on the text instead.

const data = JSON.parse(text);
JSON.stringify(data, null, 2); // pretty print, 2-space indent
JSON.stringify(data, null, "\t"); // tab indent
JSON.stringify(data); // minify

Sort keys A–Z reorders object keys at every level. It is useful before you compare two responses, since key order often changes between runs. Sort both, then paste them into the JSON diff checker to see only the real changes.

Why do big numbers change in other JSON formatters?

Most online tools parse your text into JavaScript numbers, and JavaScript numbers are 64-bit floats. Integers above 2^53 − 1 (9,007,199,254,740,991) can't all be stored exactly, so 9007199254740993 comes back as 9007199254740992 without any warning.

Integers up to 2^53 − 1 survive JSON.parse. Larger ones are rounded to the nearest value a double can hold.

This tool never converts your numbers. Its parser keeps each number as the exact text you pasted, so formatting and minifying are lossless. It also flags every number that other JavaScript code would round, with its line and column.

How do I escape or unescape a JSON string?

Press Escape string to turn everything in the input into one JSON string, with quotes and backslashes escaped. Press Unescape string to reverse it. If the unescaped text is itself valid JSON, the tool formats it for you.

You need this when JSON is stored inside JSON: log lines, message queues, a body field in a webhook, or a config value in a database. It looks like "{\"id\":1}". Unescape it, press Use as input, then format the inner document.

Escaping is not encoding. If a system wants the JSON as Base64 (common in JWTs, data URLs and some queues), use the Base64 encoder and decoder after you format it. If a field holds an epoch time like 1790000000, the Unix timestamp converter turns it into a date.

Online JSON formatter or a Chrome extension JSON formatter?

Use an online JSON formatter for text you paste or files you open. Use a Chrome extension JSON formatter if you mostly read JSON that APIs return in the browser tab, because it formats the page as it loads with no copy and paste.

This page vs a JSON formatter extension for Chrome
NeedThis pageExtension
Format pasted text or a fileYesUsually no
Auto-format a JSON URL you openNoYes
Error line, column and fixYesVaries; many just show raw text
Install or permissionsNoneNeeds access to the pages it formats
Works on a locked-down work laptopYes, if the site is allowedOnly if extensions are allowed

If you want the JSON formatter extension Chrome users install most, start with JSON Formatter, an open-source extension that formats JSON pages in place. Our JSON formatter Chrome extension guide compares the options and the permissions each one asks for. More developer picks are in developer tools.

One job this page doesn't do is convert data. A CSV to JSON formatter needs a converter first; paste its output here to check and tidy it.

Is it safe to paste JSON into an online JSON formatter?

It is safe here, because nothing is sent anywhere: the page has no server side for your data. Be careful with any other JSON formatter online: some save your input to a shareable link or process it on a server.

API responses often hold access tokens, emails or customer records. Before you paste them into any site, check its privacy note. You can confirm this page's behaviour yourself: open DevTools, go to the Network tab and press Format. No request is made.

Files up to 50 MB
Files over 1 MB stay in memory rather than in the text box, which keeps typing and scrolling smooth.
Output preview
Syntax colours switch off above about 250 KB, and the preview shows the first 1 MB. Copy and Download always include the full result.
Nesting limit
The parser stops at 1,000 levels deep. Real data rarely goes past 20.
Byte order marks
A leading BOM is ignored and reported, as RFC 8259 allows.

Prefer it in your toolbar?

This page works in any browser. If you do this every day, a Chrome extension puts it one click away. These are the picks we'd start with.

  1. JSON Formatter

    Pretty-print JSON right in the browser.

    Free Developer Tools ✓ Open source

Best JSON formatter Chrome extensions

JSON Formatter & Viewer: FAQs

What is the best free JSON formatter?

The best free JSON formatter formats instantly, pinpoints errors and keeps your data private. This one does all three in your browser, adds a tree view with copyable paths, and keeps large numbers exact. For JSON you open as URLs in Chrome, pair it with an extension.

How do I format JSON online?

Paste the JSON into the box above, or drop a .json file on it, then press Format or Ctrl/⌘ + Enter. Choose 2 spaces, 4 spaces or tabs for the indent, and copy or download the result.

Is this JSON formatter and validator really private?

Yes. All parsing and formatting happens in your browser with JavaScript. Your JSON is never uploaded, logged or saved; only your indent and display preferences are stored locally. You can confirm it in the DevTools Network tab.

What is the difference between a JSON validator and formatter?

A JSON validator checks whether text follows the JSON grammar; a formatter rewrites valid JSON with clean indentation. A formatter must validate first, so most tools, including this one, do both. Press Validate to check without changing anything.

Why is my JSON invalid?

The usual causes are a trailing comma, single quotes, unquoted keys, comments, or a missing comma between items. This tool shows the line and column, puts a caret under the problem and tells you the fix.

Can JSON have comments or trailing commas?

No. Standard JSON (RFC 8259) allows neither. Formats like JSON5 and JSONC do, and tools such as VS Code settings accept them, but strict JSON parsers reject them. Remove them before sending data to an API.

How do I pretty print JSON in JavaScript?

Use JSON.stringify(value, null, 2) for a two-space indent, or pass "\t" for tabs. It needs a parsed value, so numbers above 2^53 may already be rounded. This page formats the text directly, so it can't change them.

What does JSON minify do?

JSON minify removes every space, tab and line break outside strings. The data is identical but smaller, which suits API payloads, storage and environment variables. Press Minify above to do it.

Can I use this as a JSON viewer for large files?

Yes. Open files up to 50 MB. The tree loads children in batches of 200 and only renders what you expand, so big files stay responsive. Very large output is previewed, but Copy and Download include everything.

How do I copy the path to a value in JSON?

Switch the output to Tree and click the key or array index you want. The tool copies a JSONPath-style path such as $.items[3].name to your clipboard, ready for code, jq or tests.

Why did a large number change after formatting in another tool?

JavaScript stores numbers as 64-bit floats, so integers above 9,007,199,254,740,991 get rounded by JSON.parse. This formatter keeps numbers as written and warns you. Send big IDs as strings to avoid the problem.

Is there a Chrome extension JSON formatter?

Yes. The open-source JSON Formatter extension formats JSON pages automatically when you open them in Chrome. Our JSON formatter extension guide compares it with alternatives and their permissions. Use this page for pasted text and files.

Can I compare two JSON files here?

Not on this page. Format both files with Sort keys A–Z turned on, then paste them into our JSON diff checker to see the real differences without noise from key order or spacing.

Does this tool convert CSV to JSON?

No, it is not a CSV to JSON formatter. It formats, validates and views JSON. Convert the CSV with a converter first, then paste the JSON here to check and tidy it.

What does Unescape string do?

It decodes JSON that was saved inside a string, turning \" back into quotes and \n into line breaks. If the result is valid JSON, it is formatted straight away. Escape string does the reverse.

Sources and further reading