JSON formatter and string tools
Format or minify JSON, sort object keys, or convert between plain text and a JSON string.
- 1Add input
- 2Adjust settings
- 3Get your result
Tool input and files are processed in this browser without being uploaded.
Before you start
Make JSON easier to read, compact it, or sort object keys. You can also encode literal text as a JSON string or decode a JSON string back to text. Formatting and sorting preserve number tokens, including 9007199254740993, -0 and 1e400.
How to use this tool
- Choose a task. For formatting or key sorting, choose formatted or compact output. Formatted output can use two spaces, four spaces or tabs.
- Paste your input or select a local UTF-8 file. The file takes priority; remove it to use the pasted text again.
- Run the task, check the preview, then copy or download the complete result. Use the escaped preview to inspect tabs, line breaks and other invisible characters.
Supported inputs and limits
Paste up to 1 MiB, or select one UTF-8 file up to 10 MiB. A selected file takes priority without clearing your pasted text. The paste limit applies again when you remove the file. File names must fit within 512 UTF-8 bytes.
Parsed JSON is limited to 200,000 values, including the root, and a nesting depth of 128 (root depth 0). Complete output is limited to 20 MiB.
Use strict JSON: no comments, trailing commas or duplicate keys within an object. Keys are compared after JSON escape decoding. Unpaired Unicode surrogates are rejected. Parsing ignores one leading BOM; literal text encoding keeps it as data.
Encoding treats input as literal text and needs at least one character. Decoding accepts only a JSON string; "" creates an empty TXT file. Output layout and indentation are disabled for both string tasks.
The preview shows up to 4,000 Unicode characters. Copy and download use the complete result. Sorting reorders object keys recursively in UTF-16 order and leaves array items in place; it does not produce canonical JSON.
Processing stays in this browser. Worker loading and processing share a 10-second limit. Failed or cancelled runs do not publish a partial new result.
Worked example
Example input
{"n":9007199254740993,"a":[1,2]}Example options
{}Example output
{
"n": 9007199254740993,
"a": [
1,
2
]
}When something does not work
Check the reported problem, then run the task again. For an encoding error, save a UTF-8 copy and select it again, or remove the file to use pasted text. If a size, nesting or time limit is reached, reduce the input or output size before retrying. After cancellation, you can run again with the current input.
Frequently asked questions
Which task should I choose?
Format or minify changes JSON spacing without reordering keys. Sort keys also orders keys in nested objects. Encode text as JSON string quotes and escapes literal text; Decode JSON string reads a JSON string and returns its text. Each run performs one selected task.
Does this tool upload my input?
This tool processes input locally in your browser. The same tab may temporarily retain a recent draft when you switch tools, subject to cache limits. Refreshing or closing the tab clears it. Download any result you want to keep.
Will formatting change large numbers or validate my data?
Formatting and sorting keep number tokens such as 9007199254740993, -0 and 1e400 exactly as written. They check JSON syntax, not a business schema. Other applications may interpret those numbers differently.
Can I format JSON before checking a signature?
Keep the original signed message for verification. Formatting, minifying or sorting can change whitespace, line endings, key order or string escaping, even when the JSON values stay the same.
Can I decode an empty string or invisible characters?
Yes. Decode JSON string accepts "" and creates a zero-byte TXT file. Decoded tabs, carriage returns, line feeds and a leading U+FEFF remain in the text. The escaped preview makes them easier to inspect; copy and download use the full decoded result.
Documentation & further reading
Related tools
JavaScript regex tester
Test JavaScript patterns against text and inspect matches, positions and capture groups.
Compare text
Compare two texts line by line, with a side-by-side view of changes.
HTML formatter
Format HTML source with consistent indentation and review the result as text.
CSS formatter
Reformat CSS into readable rules with consistent indentation and spacing.