Skip to content

Offline JSON Formatter & Validator

JSON Formatter & Validator

Format, validate, minify and repair JSON in your browser. Free, instant, private and fully offline once the page has loaded.

Ready
0 characters0 linesSize 0 B– keysDepth –
Ctrl+Enter formats
12JSON tools
3indent options
0bytes uploaded
Freeno signup, no limits

What is a JSON formatter and validator?

A JSON formatter makes raw JSON readable by adding line breaks and indentation. A validator checks that the JSON follows the rules and tells you exactly where it breaks. Paste your JSON, pick a tool and copy the result. Nothing to install and nothing leaves your device.

How do I format JSON online?

Paste your JSON into the box above and click Format. The tool adds line breaks and indentation so every key and value is easy to read. Choose 2 spaces, 4 spaces or tabs first. Press Undo to go back.

How do I validate JSON?

Paste your JSON and look at the status bar. It turns green when the JSON is valid. If it is not, it shows what went wrong with the line and column. Click Go to error to jump to the problem.

How do I fix an Unexpected token error in JSON?

This error means the parser met a character it did not expect, often a trailing comma, single quotes, an unquoted key or a missing bracket. Read the line and column in the status bar and fix that spot, or click Repair JSON to fix the common ones automatically.

{'name': 'Ava',} → {"name": "Ava"}

How do I minify JSON?

Click Minify to remove all spaces and line breaks. The data stays identical but the text gets smaller, which suits API requests and config files sent to browsers.

{ "id": 7, "ok": true } → {"id":7,"ok":true}

Common JSON errors and how to fix them

Most invalid JSON comes from a short list of habits carried over from JavaScript or hand editing. Each one has a quick fix.

ErrorExampleHow to fix it
Trailing comma{"a":1,}Remove the comma after the last item.
Single quotes{'a':'b'}Use double quotes for every key and string.
Unquoted key{a:1}Wrap each key in double quotes: {"a":1}
Comments{"a":1} // noteJSON has no comment syntax. Use Strip comments.
Missing comma{"a":1 "b":2}Add a comma between the two items.
Missing bracket{"a":[1,2}Close every [ with ] and every { with }.
undefined or NaN{"a":undefined}These are JavaScript only. Use null or a string.
Leading zero{"zip":01234}Store it as a string: "01234"

Repair JSON fixes most of these automatically. Review the result before you use it, because a repair is a best guess.

JSON data types

JSON has six value types. Everything in a valid document is one of them.

TypeExampleRules
String"hello"Double quotes only. Escape quotes and line breaks with a backslash.
Number42, -3.14, 1e6No leading zeros, no plus sign, no NaN or Infinity.
Booleantrue, falseLowercase only.
NullnullLowercase only. It means there is no value.
Object{"a":1}Key and value pairs. Every key is a string.
Array[1,"two",true]An ordered list. It can mix types.

Format JSON in VS Code, Python, Node and the command line

Handy when you work with JSON files every day. The converter above is for everything else.

WhereHow to format JSON
VS CodeOpen the file and press Shift+Alt+F on Windows, Shift+Option+F on Mac or Ctrl+Shift+I on Linux.
Pythonjson.dumps(data, indent=2) in code, or python -m json.tool file.json in a terminal.
JavaScript / Node.jsJSON.stringify(data, null, 2) formats. JSON.stringify(data) minifies.
jqjq . file.json formats and validates. jq -c . file.json minifies.
Browser DevToolsOpen the Network panel, select a request and use the Preview tab for a collapsible tree.

Menu names and shortcuts can change between versions. If one does not work, paste the JSON into the converter above.

Which JSON tool should you use?

API developers

Format a response to read it, then minify a request body before you send it.

QA and testers

Validate payloads, and sort keys A to Z so two responses line up for comparison.

Data analysts

Convert an array of records to CSV and open it in Excel or Google Sheets.

DevOps and config

Convert JSON to YAML for Docker Compose, CI files and other YAML based tools.

Front-end developers

Escape JSON into a string for tests, or unescape a double-encoded API response.

Students

Learn the JSON rules by seeing exactly where the validator points at a mistake.

FormatBest forComments
JSONAPIs and data exchange between programsNot allowed
YAMLConfig files that people edit by handAllowed
CSVFlat tables for spreadsheetsNot allowed

Nested data does not always fit a flat table. To CSV flattens nested objects with dot paths and keeps arrays as JSON text.

Everything you need to work with JSON

A complete JSON toolkit for developers, testers and analysts, built to be fast and private.

12 JSON tools in one page

Format, validate, minify, repair, sort, escape and convert to CSV or YAML without switching tabs.

FormatMinifyValidateRepairSort keysCSVYAMLFlatten

Exact error location

Line, column and a pointer to the character that broke your JSON.

Undo and redo

Try any tool, then step back freely.

Exact numbers

Long IDs and decimals stay as typed. Nothing is rounded.

Instant results

Validates as you type. No waiting, no signup.

Private and offline

Everything runs in your browser. Your JSON is never uploaded or stored, and the tool keeps working without a connection once the page has loaded.

Open, copy or download

Open a .json file or drop it on the box, then copy the result or save it as a file.

See the tools in action

Real before and after examples show what each tool does to your JSON.

Minified JSON to Format

Before{"id":7,"ok":true}
After{ "id": 7, "ok": true }

Broken JSON to Repair JSON

Before{name: 'Ava', age: 30,}
After{ "name": "Ava", "age": 30 }

Records to CSV

Before[{"id":1,"name":"Ava"},{"id":2,"name":"Ben"}]
Afterid,name 1,Ava 2,Ben

Object to YAML

Before{"name":"Ava","skills":["js","sql"]}
Aftername: Ava skills: - js - sql

How the JSON formatter works

Four quick steps from raw JSON to the result you need.

Add your JSON

Paste it, type it or open a .json file from your device.

Pick a tool

Click Format, Minify, Validate, Repair JSON or any other tool.

Check the status

Green means valid. Red shows the line and column of the problem.

Copy or download

Copy to your clipboard or save the output as a file.

JSON best practices by use case

JSON shows up in many places, and each one has its own habits. These are common, widely used approaches. Always follow your team's style guide if you have one.

REST API payloads

Use double quotes, UTF-8 and one naming style, such as camelCase or snake_case, across every endpoint.

{"userName":"ava"}

package.json and config files

Use 2 space indentation and no comments. Files like tsconfig.json accept comments, but that is JSONC, not strict JSON.

{"name":"my-app"}

Logs and data exports

JSON Lines stores one object per line. That is many JSON documents in one file, so validate it one line at a time.

{"event":"login"}

Dates and times

Store dates as ISO 8601 strings in UTC so every system reads them the same way.

"2026-10-24T09:30:00Z"

Large numbers and IDs

Send IDs above 9007199254740991 as strings. JavaScript cannot hold them exactly as numbers.

{"id":"9007199254740993"}

Secrets and tokens

Remove API keys and passwords before you share JSON in tickets, chats or screenshots.

{"apiKey":"REDACTED"}

6 JSON mistakes to avoid

Small slips make a whole document invalid. Spot them quickly and fix them with one click.

Trailing comma

{"a":1,}
{"a":1}

A comma after the last item is fine in JavaScript but invalid in JSON.

Single quotes

{'a':'b'}
{"a":"b"}

JSON accepts double quotes only, for keys and for string values.

Unquoted keys

{a:1}
{"a":1}

Object literals in code can skip the quotes. JSON cannot.

Comments

{"a":1} // note
{"a":1}

Standard JSON has no comments. Put notes in a separate field or in documentation.

undefined values

{"a":undefined}
{"a":null}

Use null for an empty value, or leave the key out completely.

Leading zeros

{"zip":01234}
{"zip":"01234"}

Numbers cannot start with zero. Store codes like ZIP and phone numbers as strings.

Your JSON never leaves your browser

Many online tools send your data to a server. This one does not, which makes it a good fit for API responses, config files and private data.

Your JSONtyped, pasted or opened Formatterruns in your browser Resultcopy or download Server: unused

Nothing is uploaded

All processing happens on your device using your browser.

Works offline

The tool makes no network requests, so it keeps working after you disconnect.

Nothing is stored

We do not save, log or read what you paste.

JSON glossary

A plain-English guide to the terms you meet when you work with JSON.

{ }

Object

A set of key and value pairs wrapped in curly braces.

[ ]

Array

An ordered list of values wrapped in square brackets.

" "

String

Text wrapped in double quotes. Special characters are escaped with a backslash.

42

Number

An integer or decimal. No quotes, no leading zeros, no NaN.

T/F

Boolean

The lowercase words true or false, with no quotes.

null

Null

A value that stands for nothing. It is always lowercase.

><

Minify

Remove spaces and line breaks to make the JSON as small as possible.

A-Z

Pretty print

Add indentation and line breaks so people can read the JSON.

JSON formatter FAQ

Quick answers to the most common questions.

Can I use comments in JSON?

Standard JSON does not allow comments, so a strict validator reports an error. If your file comes from VS Code settings or tsconfig.json, click Strip comments to remove them, or Repair JSON to remove them and format the result in one step.

Is my JSON uploaded or stored?

No. Everything runs in your browser. Your JSON is not sent to a server and is not saved, so you can check API responses and config files without worry.

Does the JSON formatter work offline?

Yes, once this page has loaded. The tool makes no network requests, so you can disconnect and keep formatting. Reloading the page while offline only works if your browser has the page cached.

Will long numbers lose precision?

No. The tool keeps every number exactly as you typed it, so IDs like 9007199254740993 stay intact. Tools built on JavaScript JSON.parse round numbers above the safe integer limit of 9007199254740991.

What is the difference between JSON and a JavaScript object?

JSON is a text format with strict rules: keys and strings need double quotes, and comments, trailing commas, undefined and functions are not allowed. A JavaScript object is a live value in code and is more flexible. Use Repair JSON to turn a JavaScript-style object into valid JSON.

Is there a size limit?

The tool sets no limit. Because everything runs on your device, files of many megabytes may feel slower, especially with Validate as I type turned on.

What does Repair JSON change?

It adds quotes around keys, converts single quotes, removes comments and trailing commas, adds missing commas and closing brackets, and replaces undefined, NaN and None with null. The status bar lists every fix it made, so you can check them.

What do Escape string and Unescape string do?

Escape string wraps your text in quotes and escapes quotes and line breaks so it can sit inside another JSON string. Unescape string reverses that and formats the result if it is valid JSON.

Ready to format your JSON?

Paste it in, pick a tool and copy the result in seconds.