JSON Formatter Online Free, No Signup

Paste or drop any JSON to pretty-print it with 2, 4 or tab indentation, shrink it back to one line, and validate it while you type. The first syntax error arrives with its exact line and column, and nothing you paste ever leaves this browser.

Format, minify and validate JSON

Parsed in this tab with JSON.parse, never evaluated as code. Validation updates as you type.

Or drop a .json file

Its text loads straight into the editor above

The file is read into this tab only. Nothing is uploaded, nothing is stored.

Applies to formatting, minifying and the tree view. Array order and values are never touched.

Paste JSON or drop a file to begin.

Structure tree

JSON Formatter — illustrated, step by step

JSON Formatter{"id": 42,"tools": ["all"],"free": true}pretty print, minify, validate
How JSON Formatter works. Minified blobs re-indented and validated — errors located by line and column.
JSON formatted and validated live in the browser
Live: sample session JSON formatted with inline error hints.

How to format JSON

Three steps, no signup, and the whole thing runs in this tab.

Paste or drop your JSON

Copy an API response or config into the editor, or drop a .json file on the dropzone. Validation starts immediately and the structure tree fills in below.

Format, minify or validate

Pick 2, 4 or tab indentation, tick key sorting if you want stable output, and press Format or Minify. If something is broken, the status line names the line and column of the first error.

Copy or download

The result stays in the editor so you can keep editing. Copy it with one click, or download it as a .json file with the indentation you chose.

Why format JSON in the browser?

Because JSON is where the sensitive parts live. An API response can carry a session token on the first line, an export can carry a hundred customer records, and a config file can carry a database password. Sending all of that to a formatting website to make it readable is a trade most people would not make knowingly. Here the parse, the sort and the stringify all run in this tab, the file stays on your device, and the page keeps working offline after it loads. Details in our file-handling policy.

Troubleshooting

Are my JSON files uploaded?

No. Pasted text and dropped files are read in this browser tab, and every parse, format and minify step runs locally through JSON.parse and JSON.stringify. You can confirm it: open DevTools, go to the Network tab, work with a file, and watch nothing get sent.

Why does it report an error when another tool accepted my JSON?

Because this formatter speaks strict JSON, the same standard that JSON.parse implements and the same one APIs speak. Tools that are lenient often allow comments, trailing commas, single quotes or unquoted keys, none of which exist in JSON. The line and column reported here point at the first character that breaks the standard, so you can fix the real thing instead of the symptom.

What do the line and column numbers mean?

They are counted from 1 at the top-left corner of whatever is in the editor right now, so they always describe the text in front of you rather than an original file. If you paste minified JSON it is a single line, and the column is simply the character position of the error.

Does sorting keys recursively change my data?

No. In JSON the order of an object's keys carries no meaning, so sorting them leaves every value intact while making the text stable from edit to edit. Arrays keep their order, numbers and strings are untouched, and the sorted output parses back to the same structure.

Why did the tree view stop partway through my data?

The tree is capped at six levels deep and two thousand rendered nodes, and inputs over two megabytes skip it entirely, because drawing every node of a huge document is how a browser tab dies. The caps are a rendering limit only: the formatted and minified text in the editor is always complete.

Will formatting change my numbers?

It can, and this is worth knowing. JavaScript parses numbers as 64-bit floating point, so an integer beyond 2^53 or a decimal with more digits than a double can hold may come back with slightly different digits after formatting. If exact digits matter, check the output against your input before you ship it, or keep the original file untouched.

Can it handle very large JSON files?

Formatting and validation work on large files until your device runs out of memory, because the whole document is held in the tab rather than streamed anywhere. The tree view steps aside above two megabytes so the page stays responsive. Very large files on low-memory phones are the likeliest limit, and the tool says so instead of freezing.

Does this JSON validator show the error line and column?

Yes. Paste invalid JSON and the validator reports the exact line and column of the syntax error, so you can fix a stray comma or missing bracket without hunting through the file. It also formats and minifies valid JSON with 2, 4 or tab indentation, and everything runs in your browser, which keeps private API responses on your device.

What JSON is, and why its strictness is a feature

JSON (JavaScript Object Notation) is a text format for structured data, and its whole value comes from how little it contains. There are no comments to ignore, no optional punctuation to guess at, no line endings to argue about, and exactly one way to write any given value. That austerity is why nearly every web API speaks it, why configuration files increasingly do, and why a formatter can be trusted to rewrite your text without asking what you meant.

The grammar fits on a card. Two structures carry everything: objects, written as curly braces holding name-value pairs, and arrays, written as square brackets holding ordered values. Inside those sit six things: strings in double quotes, numbers, true, false, null, and more objects or arrays, nested as deeply as the data needs. Anything else, including single quotes, trailing commas, comments, hexadecimal numbers and unquoted keys, is not JSON, no matter how forgiving the last tool you used happened to be.

StructureExampleRules that catch people out
Object{"a": 1, "b": 2}Keys must be double-quoted strings; no trailing comma after the last pair
Array[1, 2, 3]Values of any type, mixed freely; still no trailing comma
String"hello\nworld"Double quotes only; newlines must be escaped as \n
Number-12.5e3No leading plus, no hexadecimal, no infinity, no bare .5
BooleantrueLowercase; "true" in quotes is a string instead
NullnullLowercase; the absence of a value, not an empty string

That table is also the list of things this workbench will complain about, in the friendliest way it can: with a line and a column. Because the grammar is fixed, a parser can point at the exact character where your text stopped being JSON, and that is what the status line above does the moment you paste something in.

Pretty-print vs minify: when each one is right

Pretty-printing inserts newlines and indentation so the nesting is visible. It is the format for every task involving a human: reading an API response, reviewing a config change, pasting a structure into a bug report, or diffing two exports. The trade-off is size. Whitespace is not free in a payload that travels over a network, which is exactly why pretty-printed JSON is rarely what you send.

Minifying strips that whitespace back out, leaving the tokens and separators and nothing else. It is the format for anything a machine reads: request bodies, cache entries, files written by a build step. Minified JSON is also the form most people meet by accident, when an API returns four kilobytes on a single line and the editor refuses to help. Paste it here, press Format, and the structure falls out into something a person can actually read.

Indentation width is mostly a team convention, and the honest guidance is to match whatever the project already uses. Two spaces is the common choice in JavaScript repositories, four reads more comfortably in configuration files kept by non-developers, and tabs suit teams whose editors already disagree about tab width. The choice affects only presentation: a two-space file and a tab-indented file parse to the identical structure, every single time.

JSON validator with line and column errors: the usual suspects

Browsers report JSON syntax errors with a position, and this workbench converts that position into a line and column you can act on. The trick is that the position refers to the text in the editor right now: if you fix an error on line 4, the next error's location is measured against the fixed version, which is what you want. The message itself varies by browser, but the shape is always the same: something unexpected appeared where the grammar expected something else.

Validation error (line 4, column 14)
  2 |   "items": [
  3 |     {"id": 1},
  4 |     {"id": 2},   <- trailing comma: JSON wants no comma
  5 |   ],

A short list covers most of what people paste. Trailing commas are the champion: JSON has no "last element" comma, and neither objects nor arrays tolerate one. Single quotes appear whenever the source was JavaScript rather than JSON. Comments are the next most common, followed by unquoted keys and bare words like undefined or NaN, neither of which JSON defines. A raw newline inside a string, usually from pasting a multi-line address, breaks the rule that strings must be escaped, and the column number lands right on the line break.

Usual suspectWhat it looks likeWhat JSON wants instead
Trailing comma{"a": 1,}{"a": 1}: nothing after the last pair
Single quotes{'a': 1}{"a": 1}: keys and strings in double quotes
Comment// noteRemove it: JSON has no comments
Unquoted key{a: 1}{"a": 1}: every key is a quoted string
Bare word{"v": NaN}null, a number, true or false
Raw newline in a string"line1\nline2""line1\nline2": escaped, not literal

The fix is the same every time: remove the thing JSON does not know. If the data came from JavaScript, JSON.stringify of the object will produce valid output directly. If it came from a tool that allows comments, most of those have an "export as JSON" option that strips them. And if the file is genuinely JSON5 or YAML rather than JSON, this workbench will say so by failing, which is the correct answer: an API on the other end would reject it for exactly the same reason.

Sorting keys recursively: what changes, and what never does

Turn on "sort keys recursively" and the formatter walks the parsed structure, rearranging the keys of every object into alphabetical order at every depth, then writes the result back out. Arrays are left exactly as they were, because their order is part of their meaning: a list of coordinates, a sequence of events, a stack of patches. Values are never altered. The point is stability. Servers often serialize objects in whatever order their internal bookkeeping produced, so two logically identical responses can differ in a dozen places, and a diff of those two files is noise. Sorted, the same pair differs only where the data actually changed.

This works precisely because JSON treats object key order as meaningless. Two objects with the same pairs in different orders are the same value, so rearranging them is a presentation change rather than a data change, and the sorted text parses back to a structure your code cannot tell apart from the original. It is worth doing before committing a fixture file, before pasting a payload into a code review, and whenever an export reshuffles itself between runs for no visible reason.

The toggle applies everywhere in the tool at once: the formatted output, the minified output, and the structure tree below the editor. Sorting is computed from the parsed value, so a document with a syntax error cannot be sorted at all, which is the correct order of operations. Fix the error first, then decide how you want it arranged.

The structure tree, and why it has caps

The tree view turns the parsed document into something you can click through. Objects appear with their keys, arrays with their indices, and primitives with their values, truncated on the row if a string runs long. Click any object or array to collapse or expand it, which is the fastest way to answer questions like "how deep does this nest" or "what does the third element of results actually hold" without scrolling past six thousand lines of text.

Browsers render trees by building a node per element, and the cost grows quickly: a document with fifty thousand keys becomes fifty thousand clickable rows, and the tab spends more time laying them out than your JSON spent parsing. So the tree caps itself at six levels deep and two thousand rendered nodes, and documents over two megabytes skip the tree entirely. Where a cap bites, the tool says so in a note above the tree rather than silently truncating. Every cap applies to the picture only: the formatted text in the editor is always the whole document, and copying or downloading it is unaffected.

The caps are honest engineering trade-offs rather than hidden limits. Six levels covers most API responses and configuration files in practice, and the note tells you exactly when it does not. If a document is genuinely deeper or wider than the view wants to draw, the formatted text two scroll-ups is the complete truth, and the tree is just the map.

JSON in real workflows: APIs, configs and data dumps

The most common visit here is an API response that arrived as an unreadable wall of text. Fetch a resource, get one line back, and try to find the field you care about: paste it in, press Format, and the hierarchy falls into place, with the tree view highlighting what nested where. The same move works in reverse for request bodies, where a minified payload is often what an endpoint expects and reading it before sending is the only way to be sure of what you are about to POST.

Configuration files are the second big category. Editors and linters help at development time, but the file on a server, the one inside a container image, or the one attached to a support ticket is often just text in a terminal. Validation here tells you in one line whether the file will parse when the service reads it, and the line and column point straight at the mistake. This matters most with generated configs, where a template bug puts a stray comma in at three in the morning.

Third are data dumps: database exports, analytics payloads, and logs in JSON-lines form (paste one line at a time, since a file of separate JSON documents is not itself one valid document). Sorting keys turns an export into something diffable, and validation before an import catches the truncated file that would otherwise fail halfway through a migration. All of it happens with the file on your machine, which is the whole reason this page exists.

The five mistakes that break almost every paste Strict JSON rejects all of them, and reports where the first one sits Trailing comma: {"a": 1,} Single quotes: {'a': 1} A JavaScript comment Unquoted key or bare NaN JSON.parse fails and the status line says exactly which line and column to fix Remove the extra token, keep the data Valid JSON formatted or minified keys optionally sorted tree view rendered copy or download ready The parser never guesses what you meant: it reports the first character that is not valid JSON

Security: why this workbench never uses eval

There is an old JavaScript trick for reading structured text: hand it to eval, which executes whatever it is given as code and hands back the result. It works, it is a decade and a half out of date, and it is a vulnerability with a shape. Text you meant to parse becomes instructions your page runs, so a "JSON" file containing a function call does not get parsed, it gets executed, with your session, your cookies and your origin. Anything that processes data from other people cannot afford that, and neither can anything that processes data from a folder you merely downloaded.

This tool parses with JSON.parse and nothing else. JSON.parse reads data, period: it implements the grammar from the earlier table, produces plain objects and arrays, and has no mechanism for executing anything. A payload that tries to be code simply fails to parse, which is the failure mode you want, and the failure arrives with a line and column instead of an exploit. The tree view builds DOM elements from the parsed values, treating every string as text rather than markup, so even a value designed to look like HTML renders as the characters it is.

The same reasoning governs the rest of the page. Nothing is sent anywhere, so there is no server-side log of your payloads to secure, and nothing is written to storage, so there is nothing for a later visitor of this machine to recover. The one real caution is the usual one: only paste JSON you are comfortable having on your screen, and check the file you are about to download from any tool, this one included, before you run it through a system that trusts it.

What we actually tested

This page makes specific claims, so here is how they were checked. The validator was fed a set of deliberately broken documents: a trailing comma in an object and in an array, single-quoted keys, a comment block, an unquoted key, a bare NaN, a raw newline inside a string, and a truncated file. Each produced an error rather than a result, and the reported line and column matched a manual count of the offending character in every case. Valid documents, including empty objects, deeply nested structures, unicode escapes and negative exponents, all validated and round-tripped without complaint.

The formatting claims were checked by round-tripping. Formatting an already-formatted document produced the same text, confirming the operation is stable. Sorting keys twice produced identical output, and sorting then parsing gave back a structure that compared equal to the unsorted parse, confirming that only presentation changed. Minify followed by Format returned to the same pretty-printed text as formatting the original, which is the property that makes the two operations safe to bounce between. The indent selector was exercised with 2, 4 and tab, and the byte-count readout tracked the size change for each.

The caps were verified by construction rather than guesswork: a document nested seven levels deep showed a note at the sixth, and a synthetic payload well over the node limit rendered exactly the capped number of rows with an accurate count of what was skipped. The two-megabyte skip was confirmed with an oversize input, and formatting still completed on the same text afterwards. On privacy, the usual DevTools check applies: with the Network tab open, pasting, formatting, sorting and downloading all produce zero requests, because the only engine involved is JSON.parse in your own tab.

Limits: what this formatter will not do, and why

An honest list beats a surprised user:

  • Strict JSON only. Comments, trailing commas, single quotes, unquoted keys, hexadecimal numbers and undefined are errors here, because they are errors to every conforming parser on the other end of your API call. The tool reports where, not whether.
  • Numbers are parsed as doubles. An integer beyond 2^53 or a decimal with more digits than a double carries can come back with different trailing digits after formatting. Keep the original file when exact digits matter.
  • The tree has caps. Six levels, two thousand rendered nodes, and a two-megabyte cutoff, all announced in the note above the tree. The formatted text is never capped.
  • No streaming. The whole document lives in the tab's memory, so a gigantic file on a phone may fail to load at all. Nothing is sent to a server, which is also why there is no server to offload the work to.
  • No editor features. There is no autocomplete, no schema validation, no JSON5 or YAML support, and no in-place key editing. This is a formatter and validator, deliberately small.
  • Not an executor. Nothing pasted here will ever run, which is the point. If your file contains JavaScript you wanted executed, this is the wrong tool, and using the right one should make you nervous too.

Looking for the rest of the browser-only toolkit? Everything else lives on the Tools page.

Also shrinking images?

The Image Compressor handles JPEG, PNG and WebP with a live quality slider: same privacy, same speed, still nothing leaving your device.

Open Image Compressor