JSON Formatter

A free tool to pretty-print JSON for readability, minify it to a single line, and check its syntax. All conversion of the JSON you enter runs in your browser.

0 characters
0 characters

On PC, you can also format with Ctrl / ⌘ + Enter.

ABOUT

About this JSON formatting tool

The T-APPS520 JSON formatting tool re-arranges JSON data that has no line breaks or indentation into a readable form. JSON in API responses, logs, and configuration data is often shown on a single line, which makes it hard to follow as the number of items and nesting levels grows.

"Format" parses the JSON and re-applies line breaks and indentation. "Minify" removes unnecessary spaces and line breaks and outputs single-line JSON. "Validate" checks whether the input can be parsed as JSON.

Implementation note

Formatting, minifying, and validation use the browser's built-in JSON.parse() and JSON.stringify().

BASICS

What is JSON?

JSON stands for JavaScript Object Notation, a data interchange format for representing structured data as text. Although its notation comes from JavaScript, it is not tied to any particular programming language and is widely used in web APIs, configuration files, and more.

In JSON, you can combine objects, arrays, strings, numbers, true, false, and null to represent data.

JSON example
{
  "id": 520,
  "name": "T-APPS520",
  "active": true,
  "languages": [
    "JavaScript",
    "Python"
  ]
}

EXAMPLE

What does formatting JSON look like?

Line breaks and indentation visualize the hierarchy, making values easier to understand.

Before formatting

{"user":{"id":520,"name":"T-APPS520"},"permissions":["read","write"],"active":true}

After formatting

{
  "user": {
    "id": 520,
    "name": "T-APPS520"
  },
  "permissions": [
    "read",
    "write"
  ],
  "active": true
}

HOW TO

How to use

  1. Enter JSONPaste the JSON you want to check into the input field.
  2. Choose an indentPick from 2 spaces, 4 spaces, or tab.
  3. Format, minify, or validatePress the button for your purpose. Invalid JSON shows an error.
  4. Use the resultUse "Copy result" to copy it to your clipboard.

TROUBLESHOOTING

Common JSON errors

JSON resembles JavaScript object notation, but its syntax rules are not identical. If parsing fails, check the following points.

1. Using single quotes

Wrong
{
  'name': 'T-APPS520'
}
Valid JSON
{
  "name": "T-APPS520"
}

JSON strings and object keys use double quotes.

2. A trailing comma at the end

Wrong
{
  "name": "T-APPS520",
  "active": true,
}
Valid JSON
{
  "name": "T-APPS520",
  "active": true
}

JSON does not allow a trailing comma after the last element.

3. Keys not wrapped in double quotes

Wrong
{
  name: "T-APPS520"
}
Valid JSON
{
  "name": "T-APPS520"
}

4. Comments are included

{
  // Service name
  "name": "T-APPS520"
}

Standard JSON has no comment syntax such as // or /* ... */.

JSON vs JAVASCRIPT

JSON vs. JavaScript objects

JSON is a text format that represents data. A JavaScript object, on the other hand, is a value / data structure handled inside a JavaScript program. They look similar, but JSON is more restricted in what it can express.

AspectJSONJavaScript object
Main useData exchange and storageData processing in programs
KeysDouble quotes requiredCan sometimes be omitted
StringsDouble quotesSeveral notations available
CommentsNot allowedAllowed
undefinedNot allowedAllowed
FunctionsNot allowedAllowed

CAUTION

Notes on use

Very large integers

This tool parses JSON with the browser's standard JavaScript. Very large integers beyond the range JavaScript numbers can safely represent may lose precision when parsed. Be especially careful with data that requires exact numeric matches, such as huge IDs or financial and cryptographic data.

About confidential information

We recommend not pasting API keys, access tokens, passwords, or personal information into web pages unless necessary.

PRIVACY

Your JSON and in-browser processing

This JSON Formatter formats, minifies, and validates the JSON you enter with JavaScript in your browser. We do not send the content of the input field to T-APPS520's servers for the purpose of converting JSON.

This does not mean the page never communicates at all. For how data is handled by external services used across the site, such as analytics and advertising, please see our Privacy Policy.

FAQ

FAQ

What is a JSON Formatter?

It is a tool that adds line breaks and indentation to JSON to make it readable for humans. It is useful for checking the structure of single-line JSON such as API responses and logs.

Can I check whether my JSON is valid?

Yes. Pressing "Validate" parses the input as JSON and checks whether it parses successfully. Invalid syntax shows an error.

Can I turn JSON into a single line?

Yes. "Minify" outputs single-line JSON with formatting spaces and line breaks removed.

Is the JSON I enter saved on a server?

We do not send your input to T-APPS520's servers for the purpose of formatting, minifying, or validating JSON. Conversion runs in your browser.

Does it cost anything?

This JSON Formatter is free to use.

REFERENCES

References