Code tool

JSON Formatter

Enter JSON and select a mode. Number and string tokens (including escapes and lone surrogates) stay verbatim. Duplicate keys stay present. Sorting compares decoded keys by UTF-16 order, keeping duplicate order stable. Positions use 1-based UTF-16 units. Validate mode keeps original whitespace and ignores sorting. UTF-8 byte counts and JSON/TXT exports replace literal lone surrogates with U+FFFD; escaped surrogate tokens remain unchanged. Processing stays in this browser. Nothing is uploaded.

In-browser processingNo account requiredPrivacy details ↗

JSON Formatter

Number and string tokens (including escapes and lone surrogates) stay verbatim. Duplicate keys stay present. Sorting compares decoded keys by UTF-16 order, keeping duplicate order stable. Positions use 1-based UTF-16 units. Validate mode keeps original whitespace and ignores sorting. UTF-8 byte counts and JSON/TXT exports replace literal lone surrogates with U+FFFD; escaped surrogate tokens remain unchanged. Processing stays in this browser. Nothing is uploaded.

Limit exceeded: 100,000 UTF-16 units / 400,000 UTF-8 bytes, 50,000 values, 2,000,000 output units. Maximum nesting depth is 128.

Enter JSON and select a mode.

Copy the formatted JSON separately, or copy the original validated source in validate-only mode. Download that JSON as .json. The separate report includes the original input, output and all metrics; copy it or download it as UTF-8 TXT.

A QUICK WALKTHROUGH

How to use this tool

  1. Enter JSON and select a mode.
  2. Process JSON · Pretty: 2 spaces / Pretty: 4 spaces / Compact / Validate only
  3. Copy formatted JSON · Download JSON · Copy report · Download TXT

Sort object keys recursively

Number and string tokens (including escapes and lone surrogates) stay verbatim. Duplicate keys stay present. Sorting compares decoded keys by UTF-16 order, keeping duplicate order stable. Positions use 1-based UTF-16 units. Validate mode keeps original whitespace and ignores sorting. UTF-8 byte counts and JSON/TXT exports replace literal lone surrogates with U+FFFD; escaped surrogate tokens remain unchanged. Processing stays in this browser. Nothing is uploaded.

Input bytes

Limit exceeded: 100,000 UTF-16 units / 400,000 UTF-8 bytes, 50,000 values, 2,000,000 output units. Maximum nesting depth is 128.

Position

Position / Line / Column · Number and string tokens (including escapes and lone surrogates) stay verbatim. Duplicate keys stay present. Sorting compares decoded keys by UTF-16 order, keeping duplicate order stable. Positions use 1-based UTF-16 units. Validate mode keeps original whitespace and ignores sorting. UTF-8 byte counts and JSON/TXT exports replace literal lone surrogates with U+FFFD; escaped surrogate tokens remain unchanged. Processing stays in this browser. Nothing is uploaded.

JSON and report exports

Copy the formatted JSON separately, or copy the original validated source in validate-only mode. Download that JSON as .json. The separate report includes the original input, output and all metrics; copy it or download it as UTF-8 TXT.

GOOD TO KNOW

Common questions

Number values / Repeated object keys?

Number and string tokens (including escapes and lone surrogates) stay verbatim. Duplicate keys stay present. Sorting compares decoded keys by UTF-16 order, keeping duplicate order stable. Positions use 1-based UTF-16 units. Validate mode keeps original whitespace and ignores sorting. UTF-8 byte counts and JSON/TXT exports replace literal lone surrogates with U+FFFD; escaped surrogate tokens remain unchanged. Processing stays in this browser. Nothing is uploaded.

Validate only?

Number and string tokens (including escapes and lone surrogates) stay verbatim. Duplicate keys stay present. Sorting compares decoded keys by UTF-16 order, keeping duplicate order stable. Positions use 1-based UTF-16 units. Validate mode keeps original whitespace and ignores sorting. UTF-8 byte counts and JSON/TXT exports replace literal lone surrogates with U+FFFD; escaped surrogate tokens remain unchanged. Processing stays in this browser. Nothing is uploaded.

Maximum nesting depth?

Limit exceeded: 100,000 UTF-16 units / 400,000 UTF-8 bytes, 50,000 values, 2,000,000 output units. Maximum nesting depth is 128.