Format JSON Online

Beautify, format and validate JSON strings in your browser: paste JSON, press Format, and read it back indented with syntax highlighting, or as a collapsible tree. Invalid JSON comes back as the first parse error, naming the line the parser stopped on. Nothing is uploaded unless you save or share.
Updated:

About Online JSON Formatter and Validator

Paste a minified or hand-edited JSON string into the Source JSON field and press Format: it comes back in the Formatted JSON box, indented four spaces, with syntax highlighting. If the string is not valid JSON, that box shows the parse error instead, naming the line it happened on. Both steps run in your browser: the JSON you paste reaches ReqBin only if you press Save or Share.

  • Convert poorly formatted or minified JSON to well-formatted human-readable JSON
  • Validate JSON with a built-in JSON linter and get the first parse error with its line number
  • Save JSON in the cloud and access it anywhere and on any device
  • Share and collaborate your JSON data snippets online
  • Formatting and validation run in the browser — nothing is uploaded until you press Save or Share
  • Upload JSON files into Online JSON Formatter & Validator from your disk
  • JSON syntax highlighting
  • Free to use

What is JSON?

JSON (JavaScript Object Notation) is an open and lightweight format that uses human-readable text to structure, store, and transmit data over a network. JSON is independent of the programming language of your system and is easy to parse into logical syntactic components, even though it is derived from JavaScript.JSON is a widely used data format that is often used to store and transfer data objects, for example, for client/server interactions. JSON is an informative and easy-to-understand format. The MIME type for JSON is application/json. JSON files use the .json filename extension.

Why format and validate JSON?

JSON is primarily used for transferring data over the network, and many servers minify it to save bandwidth. This does not affect the data in the JSON file, but it makes the JSON code unreadable to humans. Also, when generating or minimizing a JSON file, servers may sometimes generate incorrect JSON, leading to data corruption and causing API clients and servers to work incorrectly. Finding an error in JSON data string can be difficult and time-consuming. When formatting JSON manually, you may inadvertently break JSON and break your application. Therefore, it becomes mandatory to format the JSON code with a JSON formatter, which re-indents the code and can display it as a collapsible tree. An online formatter that names the line the parser stopped at is the short way out of that.

How to format JSON Online?

To format your JSON string online, paste it into the Source JSON field and click on the Format JSON button. The formatted JSON appears in the Formatted JSON box. If the string does not parse, that same box shows the error instead of the output: Parse error on line 3, the fragment it stopped at with a caret under the offending character, and what it expected there — Expecting 'EOF', '}', ':', ',', ']', got 'NUMBER'. Only the first error is reported, so fix it and press Format again to reach the next one.

How to validate JSON online?

Formatting and validation are the same button here: press Format and valid JSON comes back indented, invalid JSON comes back as the parser's complaint. The built-in linter checks the string against the JSON grammar, which is stricter than most people expect — single-quoted strings, unquoted keys, a trailing comma before } and True spelled with a capital are all rejected, and so is a // comment. Nothing is uploaded to run the check.

Is a JSON Beautifier the same as a JSON Formatter?

Yes. "JSON beautifier", "JSON formatter" and "JSON pretty printer" describe the same operation: re-indenting a minified JSON string so that it can be read. The keys and values are untouched, only the whitespace changes. ReqBin Online JSON Formatter beautifies JSON entirely in the browser, so whichever of those names you were looking for, this is the tool.

How to beautify JSON online?

To beautify your JSON, paste the minified JSON data string into the Source JSON field and click on the Format JSON button. The beautified JSON appears in the Formatted JSON box with one key per line and each level indented four spaces. If the JSON is invalid, the beautifier reports the parse error rather than producing broken output.

Why format JSON online?

Nothing to install and no browser plug-in: the page carries its own editor, parser and formatter, and all three run on the machine you opened it on. That also decides what happens to your data — a JSON string you paste to check a production payload stays on your machine unless you save or share it.

How does the JSON formatter and validator work?

The page loads a JSON parser and a formatter into the browser and runs both on the Format button. The parser reads the string against the JSON grammar and stops at the first thing it cannot accept, reporting the line and the token it stopped on; the formatter then re-indents the value the parser produced. Neither step contacts the server; the string leaves the page only through the Save and Share buttons.

Online JSON Formatter Example

Below is an example of the original JSON and the formatted result.

Original JSON Example
{"Id": 78912,"Customer":"Jason Sweet","Quantity": 1,"Price": 18.00}

And an example of how the online JSON formatter works.

Formatted JSON Result
{
    "Id": 78912,
    "Customer": "Jason Sweet",
    "Quantity": 1,
    "Price": 18.00
}

JSON Format Rules

JSON is derived from JavaScript, but no JavaScript knowledge is required to use it. When creating JSON, certain rules must be followed:

  • Data is represented by name/value pairs.
  • Commas separate data.
  • Objects are enclosed in opening and closing curly braces {}.
  • Arrays are enclosed in opening and closing square brackets [].
  • Boolean values are represented using the literals true or false in lowercase.
  • Dates and similar object types are not supported properly and must be converted to strings.
  • Numeric values are in double precision floating point format and must not have leading zeros.
  • Null values are represented by a lowercase null literal.
  • The standard extension for a JSON file is ".json".
  • The MIME type for JSON files is application/json.

How to pretty print JSON online?

Pretty printing is the same operation as formatting: press Format and the JSON comes back with four-space indentation, one key per line, and every level laid out by depth. Press Structure to read the same result as a collapsible tree instead, with the number of keys shown on each node. To pretty-print JSON inside your own code rather than on this page, see the JavaScript and Python examples.

Online XML Formatter and Validator

If you need to format XML data strings, you can use our XML Formatter, which provides the same feature set as JSON Formatter but for XML strings.