FlipMyFormat

JSON Formatter

Format, validate and repair JSON in your browser. Beautify with 2 spaces, 4 spaces or tabs, minify to one line, find errors by line and column, and read the data as a folding tree or a table. Free and private.

Indent
Paste or upload JSON to check it.

Convert it further: JSON to Excel. Your JSON never leaves this page.

People also use

JSON formatter online: check, fix and format JSON in three steps

Paste JSON into the left box, drop a .json file on it, or press Upload. The status line under the box checks it as you type: a green line says Valid JSON with the size, the number of keys, the number of array items and the depth, and a red line gives the exact error with its line and column. As soon as the JSON is valid, the right side shows a neatly indented copy.

This json formatter online runs in any modern browser on a computer, tablet or phone. Everything happens on your own device: the text is parsed and formatted by code in the page, and nothing is sent to a server. There is no account, no limit on how often you use it, and files up to 100 MB can be opened.

Beyond plain formatting, the toolbar can minify JSON to a single line, repair almost-JSON copied from code or logs, escape JSON so it fits inside a string, and unescape it again. The output can be read as text, as a folding tree or as a table, and the Path box narrows everything down to the one part you care about.

  1. 1

    Add your JSON

    Paste it into the left box, drop a file on it, or press Upload to open a .json, .geojson or .txt file up to 100 MB. Press Sample to try the tool with a small example.

  2. 2

    Check and fix

    Read the status line under the box. If it says Invalid JSON, press Show to jump to the problem, fix it by hand, or press Try to repair.

  3. 3

    Format and save

    Choose 2 spaces, 4 spaces or Tab, press Format or Minify (one line), pick the Text, Tree or Table view, then press Copy or download the result as .json.

Your indent, Sort keys A–Z, view and tree settings are remembered in this browser for next time. The JSON itself is not saved, so copy or download the result before you close the tab.

What each button and option does

Format

Writes the JSON out with line breaks and the indent you chose, and switches the output to the Text view. If the input is not valid, it asks you to fix the error or press Repair first.

Minify (one line)

Removes every space and line break that is not inside a string, so the whole document sits on a single line.

Repair

Rewrites the input box with fixed, formatted JSON when the text is almost JSON: comments, single quotes, unquoted keys, missing or trailing commas and a few values JSON does not allow.

Escape and Unescape

Escape turns JSON into one quoted string with backslashes, ready to place inside another string. Unescape reverses it and puts the plain JSON back in the input box.

Indent

2 spaces, 4 spaces or Tab. Changing it reformats the output straight away.

Sort keys A–Z

Puts the keys of every object, at every level, in alphabetical order. Arrays keep their order.

Path

Type a path such as items[0].name to format, view, copy or download only that part of the document.

View

Text shows the formatted JSON, Tree shows an outline you can fold, and Table shows an array of objects as rows and columns.

Copy and .json

Copy puts the result on your clipboard and .json downloads it as formatted.json. Both use the formatted or minified text, whichever view is open.

Upload, Sample and Clear

Upload opens a file, Sample loads a small example shop with two items and an address, and Clear empties the input, the output and the Path box.

JSON formatter and validator: what the error messages mean

The page is a json formatter and validator in one. Every change in the input box is checked straight away with your browser's own JSON parser, which follows the same strict rules as JSON.parse in JavaScript. When the text passes, the status line turns green and reads Valid JSON, followed by the size of the text and three counts for the whole document: keys in all objects, items in all arrays, and how deeply the data is nested.

When it fails, a second parser reads the text again to find out where and why. The status line then says Invalid JSON with a plain reason and the position, for example Comma before } (trailing comma) at line 14, column 3, and the box border turns red. Press Show and the cursor jumps to that exact character in the box, so you do not have to count lines yourself.

Line and column both start at 1, and a tab counts as one column. The position is where the parser gave up, which is usually on the problem itself or just after it. A missing comma, for example, is reported at the start of the next value, not at the end of the one before it.

MessageWhat it usually means
Comma before } (trailing comma)The last property in an object has a comma after it. Delete that comma.
Comma before ] (trailing comma)The last item in an array has a comma after it.
Expected a property name in double quotesA key is in single quotes or has no quotes at all, such as {name: 1}. JSON keys need double quotes.
Expected , or } after a property valueA comma is missing between two properties, often after a line you pasted in.
Expected , or ] after an array itemA comma is missing between two array items, or a bracket was closed with the wrong type.
Expected : after the property nameA key has no colon after it, or an equals sign was typed instead.
Unexpected characterSomething that cannot start a value, such as a single quote, a bare word or a stray symbol. The message shows the character.
Line break inside a string (use \n)A string runs over two lines. Write the break as \n instead.
Unknown escapeA backslash is followed by a letter that means nothing in JSON, such as \x, or a Windows path has single backslashes.
Unclosed stringA string starts with a quote and never ends.
Unexpected end of the textThe text stops before every { and [ is closed, often because a copy was cut short.
Extra text after the JSONThere is more after the end of the data, such as a second object, a semicolon or a stray bracket.

The JSON rules behind most errors

Most errors come from a short list of rules that JSON is strict about. Keys and strings must use double quotes, never single quotes. Every key needs quotes, even a simple one such as id. Items and properties are separated by commas, and there is no comma after the last one.

Only a few kinds of value exist: strings, numbers, true and false, null, and objects or arrays that hold more of them. True with a capital T, None, NaN, undefined and dates written without quotes are not JSON. Numbers are written in plain decimal, with an optional minus sign, fraction and exponent; leading zeros, a leading plus sign and hex are not allowed.

Inside a string, a double quote or a backslash must be escaped with a backslash, and a line break must be written as \n. Comments are not part of JSON at all. The whole text must be one value: one object, one array or one single value, with nothing after it but spaces.

Repair almost-JSON: comments, quotes, commas and Python values

Plenty of text looks like JSON but is not quite: a config file with comments, an object copied from JavaScript code, or a Python dictionary printed in a log. Press Repair, or Try to repair on the red status line, and a forgiving parser reads it and writes proper JSON back into the input box, formatted with your chosen indent.

Repair does not guess at broken structure. A missing closing bracket, a string that never ends, or two separate objects one after the other still fail, and the message tells you where. There is no undo button for the input box, so if you need the original text, copy it somewhere first.

ProblemBeforeAfter Repair
Comments// line, /* block */ and # line commentsRemoved
Single quotes{'name': 'Pen'}{"name": "Pen"}
Unquoted keys{name: "Pen", in_stock: true}{"name": "Pen", "in_stock": true}
Trailing commas[1, 2, 3,][1, 2, 3]
Missing commas{"a": 1 "b": 2}{"a": 1, "b": 2}
Python values{"ok": True, "x": None}{"ok": true, "x": null}
NaN, Infinity, undefined{"score": NaN}{"score": null}
Line breaks in stringsA string split over two linesThe break kept as \n

Check repaired data before you rely on it. NaN, Infinity and undefined have no JSON equivalent, so they become null, and comments are dropped because JSON has no place for them. If a value matters, put it back by hand in a form JSON allows, such as a string.

JSON beautifier free online: 2 spaces, 4 spaces or tabs

Formatting, also called beautifying or pretty printing, adds a line break after every value and indents each level of nesting so the structure is easy to follow. If you were looking for a json beautifier free online, this is the same job: paste the data, and the indented version appears on the right.

Pick the indent with the three buttons next to Indent. The output changes straight away, and Format writes it out with the new setting. Beautifying never changes the data itself, only the spaces and line breaks between values.

IndentLooks likeGood for
2 spacesEach level moves two spaces to the rightWeb projects, package.json and most JavaScript code; compact but clear
4 spacesEach level moves four spacesPython projects and teams that like wider indents; easiest to scan in long files
TabEach level is one tab characterEditors set to show tabs at your own width; the smallest formatted file

Formatting works by reading the JSON into memory and writing it out again, so a few details come out in a standard form: 1.0 becomes 1, 1e3 becomes 1000, \u00e9 becomes é and \/ becomes /. The meaning is identical; only the spelling changes. If you need the original text byte for byte, keep a copy.

JSON formatter with collapse: the tree view

Switch the output to Tree and the JSON becomes an outline you can fold. This json formatter with collapse support opens the first two levels when you start, so you see the top of the data without being buried in it. Click the small arrow next to any object or array to fold or unfold it.

A folded object shows how many keys it holds and a folded array shows how many items, such as 12 items or 5 keys, so you can judge the size of a branch before you open it. Click that badge to open it. Expand all opens every level at once, and Collapse all folds everything below the top.

Keys are shown in purple and work as buttons. Click one and its path, such as items[0].name, goes into the Path box, and the output narrows to that value. Strings are green, numbers blue, true and false amber, and null grey, so types stand out at a glance. A very long array or object shows its first 2,000 children and a note with how many more there are; use the Path box to reach the rest.

JSON formatter to one line: minify for configs, APIs and logs

Minify (one line) strips every space, tab and line break that sits between values and puts the whole document on a single line. Spaces inside strings are kept, because they are part of the data. Use the page as a json formatter to one line when you need to paste data into an environment variable, a command line, a single log entry, a test fixture or a request body.

Minified JSON is also smaller to store and send. How much smaller depends on the original: the more indentation and line breaks it had, the more it shrinks, while a file that was already compact barely changes. The size in the status line is the size of what is in the input box, so paste the minified result back in to compare.

To go back, press Format and the data is laid out again with your indent. Minify also follows Sort keys A–Z and the Path box, so you can produce one sorted line from just one part of a large file.

JSON formatter for large data: files up to 100 MB

Upload accepts files up to 100 MB, and you can drop a file straight onto the input box. Because everything runs in your browser, a large file never has to travel to a server and back, and what the page can handle is set mostly by your device's memory.

A few habits make this json formatter for large data feel quick. Read the status line first: it gives the size, key count, array items and depth before you scroll anything. Then use the Tree view, which opens only two levels and shows at most 2,000 children per branch, instead of the Text view, which has to draw every line. When you find the part you want, type its path or click its key in the tree, and work on that alone.

A desktop browser copes with much bigger files than a phone. If a tab becomes slow, close other tabs, keep the tree folded, and use Minify, Copy and download rather than scrolling through endless formatted lines. Table view shows the first 1,000 rows and up to 50 columns, which keeps it responsive even when the array is much longer.

Path filter: work on one part of the document

The Path box shows a single part of the document. Separate keys with dots and put array positions in square brackets, counting from 0. A leading $ or $. is allowed, so simple paths copied from other tools work as they are.

The path applies to everything on the right: the Text, Tree and Table views, Format, Minify, Copy and the .json download. The counts in the status line still describe the whole document. If nothing exists at the path, the output says Nothing at that path.

PathShows (with the Sample)
itemsThe array of both items, which also works in Table view
items[0]The first item, the pen, with all its keys
items[0].name"Pen"
items[1].tagsAn empty array, []
address.city"Pune"
$.items[0].tags[1]"office"

Paths do not support wildcards, filters or quoted keys in brackets. Keys that contain a dot or a square bracket cannot be reached by path, so read them in the Tree view instead.

JSON formatter to table: arrays of objects as rows, with CSV

Many APIs return a list of records: an array where every item is an object with similar keys. Switch to Table and that array becomes a grid, one row per item and one column per key. Using the page as a json formatter to table this way makes it easy to scan prices, names or IDs down a column.

Columns are collected from all the rows, so an item with an extra key adds a column and an item without it leaves that cell empty. A nested object or array in a cell is shown as compact JSON. Long values are cut off with an ellipsis in the grid but kept in full in the CSV.

Press CSV to download the grid as table.csv, ready for a spreadsheet. Values with commas, quotes or line breaks are quoted properly. The grid and the CSV hold the first 1,000 rows and up to 50 columns. To get an Excel file from your data instead, JSON to Excel does that.

If your array is not at the top, as in the Sample, where it sits under items, type items in the Path box. If the view says it needs an array of objects, the data at that point is a single object, a plain list of values, or a list that mixes objects with other things.

JSON formatter with escape characters: escape and unescape

Sometimes JSON has to live inside another string: a field in another JSON document, a string in source code, or a message on a queue. Every double quote then needs a backslash in front of it, and line breaks become \n. A json formatter with escape characters handles that for you in one click.

Escape takes the JSON and outputs it as a single quoted string, with quotes, backslashes, tabs and line breaks escaped. It uses the output if you have just pressed Format or Minify, and otherwise the input exactly as typed. Press Minify first and then Escape for the shortest one-line string.

Unescape works the other way. Paste an escaped string, with or without its outer quotes, and press Unescape: the backslashes are removed and the plain JSON is put into the input box, where it is checked and formatted like anything else. If the text is not a valid escaped string, you see This is not an escaped JSON string.

CharacterEscaped as
Double quote\"
Backslash\\
Line break\n
Tab\t
Carriage return\r
Other control characters\b, \f, or \u and four hex digits

An escaped string pasted with its outer quotes is valid JSON on its own: the validator sees one string value, and the Tree view shows it as a single green line. That is the sign it still needs Unescape. JSON allows a forward slash to be escaped as \/ but does not require it, so Escape leaves slashes as they are.

Sort keys A–Z for cleaner comparisons

Tick Sort keys A–Z and the keys in every object are put in alphabetical order, at every level of nesting. Arrays keep their order, because the position of an item usually means something. The setting affects the output, Format, Minify, the tree and the table.

Sorting helps when you compare two versions of a file. Two JSON documents with the same data but keys in a different order look completely different in a text diff; sorted, the real changes stand out. The order is by character code, so capital letters come before small ones and digits before letters: Zip sorts before city.

Common jobs it helps with

Reading an API response

Paste the body from your browser's network tab or a command-line request, check that it is valid, and open the tree to find the field you need.

Fixing a config file

Find the trailing comma or missing quote that stops an app from starting. Show jumps straight to it.

Cleaning data copied from code

Objects copied from JavaScript or a Python print have single quotes, unquoted keys or True and None. Repair turns them into real JSON.

Preparing test data

Minify a fixture to one line, or escape it to paste into a string in a unit test.

Comparing two versions

Format both with Sort keys A–Z and the same indent, then compare them in your diff tool.

Checking an export

Open an array of records in Table view to spot empty fields, then download the CSV for a spreadsheet.

Tips for faster fixing and formatting

Fix the first error first

The parser stops at the first problem it finds. One missing quote can make everything after it look wrong, so fix the reported spot, then look at the status line again.

Look just before the position

A missing comma or bracket is often reported on the line after the real slip. If the marked character looks fine, check the end of the line above it.

Keep a copy before Repair

Repair replaces the input box. Copy the original somewhere first if you may need the comments or the exact layout back.

Narrow down big files

Click keys in the Tree view to build the path to the part you need, then use Format, Copy or download on that part alone.

Use the same settings for diffs

When you compare two files, format both with the same indent and with Sort keys A–Z turned on, so only real changes show up.

Minify before you escape

Escape keeps the spaces of whatever it is given. Press Minify (one line) first and the escaped string is as short as it can be.

Troubleshooting: when the result is not what you expected

Valid in my editor but invalid here

Some editors accept JSON with comments or trailing commas, as in JSONC and JSON5. Standard JSON does not, so the validator reports them. Press Repair to clean them up.

A big number changed

Numbers above 9,007,199,254,740,991 cannot be held exactly by JavaScript, so long IDs can lose their last digits. Store such IDs as strings.

A key disappeared

If an object has the same key twice, the parser keeps the last value, so the formatted output shows that key only once.

Number-like keys moved to the top

Browsers list keys made only of digits first, in number order, whatever order they were written in. The data is unchanged.

Several objects in one file

Files with one object per line, known as JSON Lines, are reported as Extra text after the JSON. Paste one line at a time, or wrap the lines in [ ] with commas between them.

Repair could not fix it

Repair fixes small slips, not missing brackets or cut-off text. Read the message, check the end of the file, and close any open { or [.

Numbers like .5 or 0x1F

JSON numbers need a digit before the point and cannot be hex. Write 0.5 and 31 instead.

Typing in a huge file is slow

The text is checked again after every change. Fix large files in your code editor and paste them in, or work on one part with the Path box.

Copy does nothing

Some browsers block clipboard access. Press .json to download the result, or select the output text and press Ctrl+C, or Cmd+C on a Mac.

JSON formatter free to use: no account, nothing uploaded

This is a json formatter free to use as often as you like, with no sign-up, no account and no daily limit. Every button you see is open to everyone.

Your JSON is parsed, checked, repaired and formatted by code running in this page, on your own device. It is not uploaded, and files you open are read by the browser, not sent to us. That matters for API responses with tokens, customer exports and private config files. Only your settings are kept, in this browser's local storage; the JSON itself is not saved anywhere.

JSON formatter without ads or pop-ups inside the tool

Reading a big document is hard enough without things moving around it. There are no pop-ups or ads inside the formatter: the toolbar, the input box and the output panel are all tool, and nothing is placed between your data and the result. If you wanted a json formatter without ads getting in the way of your work, the tool area is kept clean for exactly that reason.

There is also nothing to install: no extension, no desktop app and no plugin. Bookmark the page and it opens with your last indent, view and sort settings.

What to do next

Need the data in a spreadsheet? JSON to Excel turns an array of records into an Excel file, and CSV to PDF makes a printable page from the CSV you downloaded in Table view. Writing documentation for your API? Word Counter checks its length and Case Converter tidies the headings. Need filler text for a mock response? Lorem Ipsum Generator makes some in a click.

Frequently asked questions

Is this json formatter online safe for private data?

Yes. The JSON is parsed and formatted by code running in your browser, and it is never uploaded. Files you open are read on your device too. Only your settings, such as the indent, are saved in this browser.

How does the json formatter and validator show errors?

The status line under the input turns red and says Invalid JSON, with a reason and the line and column, for example Expected , or } after a property value at line 8, column 5. Press Show to jump to that spot, or Try to repair.

Is the json formatter free, or are some features paid?

It is free, and every feature is open to everyone: format, minify, repair, escape, tree, table and CSV. There is no account, sign-up or usage limit.

Where can I find a json beautifier free online that keeps my data private?

Right here. Beautifying happens in your browser, so the data never leaves your device. Pick 2 spaces, 4 spaces or Tab and the formatted JSON appears on the right.

Is there a json formatter with collapse and expand for nested data?

Yes. Switch the output to Tree. Each object and array can be folded with its arrow, a folded one shows its item or key count, and Expand all or Collapse all change every level at once.

How do I use the json formatter to one line?

Press Minify (one line). Every space and line break outside strings is removed and the whole document sits on a single line, ready to copy or download.

Can I use the json formatter for large data files?

Yes. You can open files up to 100 MB. For big files, read the summary in the status line, use the Tree view rather than the Text view, and narrow things down with the Path box.

How does the json formatter to table view work?

When the output is an array of objects, Table shows one row per object and one column per key, for up to 1,000 rows and 50 columns. Press CSV to download it as table.csv.

Does the json formatter with escape characters also unescape?

Yes. Escape turns JSON into one quoted string with backslashes, and Unescape turns an escaped string back into plain JSON in the input box. The outer quotes are optional when you unescape.

Is this a json formatter without ads in the tool?

Yes. There are no pop-ups or ads inside the formatter. The toolbar, the input and the output are only the tool, so nothing covers your data while you work.

What can Repair fix?

Comments, single quotes, unquoted keys, trailing commas, missing commas between values, NaN, Infinity and undefined, and Python True, False and None. It cannot rebuild missing brackets or text that was cut short.

Why does it say trailing comma?

There is a comma after the last item of an object or array, as in [1, 2, 3,]. JavaScript allows that but JSON does not. Delete the comma, or press Repair.

Does JSON allow comments?

No. Standard JSON has no comments, so // and /* */ make it invalid. Repair removes them, but they are lost, so keep your notes somewhere else if you need them.

Which indent should I choose?

2 spaces is the most common choice for web projects, 4 spaces is easier to read in long files, and Tab lets each person's editor pick the width. The data is the same with any of them.

What does Sort keys A–Z do?

It puts the keys of every object in alphabetical order, at every level, while arrays keep their order. That makes two versions of a file much easier to compare.

How do I format only part of a JSON file?

Type a path such as items[0] or address.city in the Path box, or click a key in the Tree view. The output, Copy and the download then use only that part.

What do the keys, items and depth numbers mean?

Keys is the total number of keys in all objects, array items is the total number of items in all arrays, and depth is how many levels of nesting the data has. They always describe the whole document.

Why did a long number change after formatting?

JavaScript keeps only about 15 to 17 significant digits of a number, so integers above 9,007,199,254,740,991 can change. Keep long IDs as strings in your JSON.

Can I open JSON Lines or NDJSON files?

Not as one document. A file with one object per line is reported as Extra text after the JSON. Paste one line at a time, or turn the lines into an array first.

Does it work on a phone?

Yes, in any modern mobile browser. Paste the JSON or upload a file, and use the Tree view to read it on a small screen. Very large files work better on a computer.

Does it work offline?

Once the page has loaded, checking, formatting and repairing all run in your browser, so they keep working if your connection drops. Reloading the page needs a connection.

Format your JSON now

Paste, upload or try the sample, and see it checked and formatted as you type. Free and private.

Start formatting

Last updated October 2026 · Written and maintained by the FlipMyFormat team