JSON Formatter & Validator

Format, validate, or minify JSON without uploading it anywhere.

How to format JSON

Paste a JSON object or array into the input area and select Format JSON. The tool checks the syntax and displays the result with two-space indentation. Select Minify when you need a compact, single-line JSON string for an API request or configuration file. Use Copy result to copy the output.

Example

This compact input:

{"name":"TxConv","tags":["text","json"],"private":true}

is formatted as an indented structure with name, tags (an array holding text and json), and private each on their own lines. Selecting Minify on that formatted result brings it back to a single line.

What makes JSON valid

  • Property names and strings must use double quotes. Single quotes are not allowed.
  • Trailing commas after the last item are not allowed.
  • Comments are not part of JSON.
  • Values such as undefined, NaN, and Infinity are not valid JSON.

When the input is invalid, the tool shows a message that starts with “Invalid JSON” followed by the browser’s own error description. The exact wording differs between browsers, but it usually points to the position of the problem.

Privacy and limitations

The formatting code runs in your browser. TxConv does not receive the JSON you enter. Because the tool uses the browser’s JSON parser, a few behaviors of JavaScript apply:

  • Large numbers lose precision. Integers beyond 9,007,199,254,740,991 cannot be represented exactly. For example, 12345678901234567890 is output as 12345678901234567000. Keep such IDs as strings.
  • Duplicate keys. If the same key appears twice in one object, only the last value is kept.
  • Key order. Keys that look like whole numbers (for example "1" and "2") are moved to the front in ascending order. Other keys keep their original order.

Common uses

Use this tool to inspect API responses, prepare test fixtures, validate configuration files, or make JSON easier to review in a pull request. Minifying is useful when you need to paste JSON into a single-line field, an environment variable, or a command-line argument.

Frequently asked questions

Why does my JavaScript object not validate?

JavaScript object literals are more relaxed than JSON. Unquoted keys, single quotes, comments, and trailing commas work in code but are rejected by a JSON parser.

Does formatting change my data?

Whitespace is the only intended change. The exceptions are the number precision, duplicate key, and key order behaviors described above.

Is there a size limit?

There is no fixed limit, but very large documents depend on your browser’s memory and can make the page slow.

Is my JSON uploaded anywhere?

No. Parsing and formatting run in your browser and the JSON you enter is not sent to TxConv.

More English tools

Looking for Japanese text tools such as full-width/half-width conversion, hiragana/katakana conversion, or tax calculation? See the Japanese edition of TxConv.