oktools
Security
Data
Converters
Generators
oktools
Security expand_more
password
Password Generator
Generate strong random passwords.
lock
Hash Generator
Generate MD5, SHA-1, SHA-256, SHA-512 hashes.
verified_user
JWT Decoder
Decode and inspect JSON Web Tokens.
workspace_premium
SSL Certificate & CSR Decoder
Decode X.509 certificates, chains and CSRs.
Data expand_more
code
JSON Formatter & Validator
Format and validate JSON.
difference
JSON Compare (Diff)
Compare two JSON documents.
regular_expression
Regex Tester & Explainer
Test regular expressions and see what they do.
event_repeat
Cron Expression Parser
Decode cron expressions and preview run times.
compare_arrows
Text Diff & Compare
Compare two texts line by line.
Converters expand_more
code
Base64 Encoder/Decoder
Encode and decode Base64 text/files.
link
URL Encoder/Decoder
Encode URLs and query parameters.
access_time
Unix Timestamp Converter
Convert Unix timestamps to readable dates.
swap_horiz
CSV ↔ JSON Converter
Convert between CSV and JSON.
tag
Number Base Converter
Convert binary, octal, decimal and hex.
palette
Color Converter & Contrast Checker
Convert HEX, RGB, HSL, OKLCH and check WCAG contrast.
straighten
Unit Converter
Convert kg to lbs, cm to inches, miles to km and more.
public
Time Zone Converter
Convert times between time zones and cities.
Generators expand_more
credit_card
Credit Card Number Generator (test numbers only)
Generate valid-format test card numbers (non-functional).
format_list_numbered
UUID Generator
Generate UUID/GUID values.
pin
SSN Generator
Generate fake Social Security Numbers with names.
text_fields
Lorem Ipsum Generator
Generate placeholder text.
qr_code_2
QR Code Generator
Create QR codes for links, Wi-Fi, contacts and more.
Home->Data->JSON Formatter & Validator
code

JSON Formatter & Validator

Paste JSON to beautify it with a pretty print at the indent you choose, or minify it to a single line for a request body. The JSON validator lints the text as you type and names the line and column where parsing stopped. Everything runs in your browser; nothing is uploaded.

Format:
input

More Data tools

differenceJSON Compare (Diff)Compare two JSON documents.arrow_forwardregular_expressionRegex Tester & ExplainerTest regular expressions and see what they do.arrow_forwardevent_repeatCron Expression ParserDecode cron expressions and preview run times.arrow_forward

Frequently asked questions

How do I format or beautify JSON?

Paste the JSON into the input box and it is re-indented as you type, with nesting laid out one level per step so you can see the structure. Minify collapses it back to a single line with no whitespace, which is the form you want in a request body or a config value. Validate confirms the document in a message, in case you want the explicit answer rather than the formatted output.

Can I change the indentation or sort the keys?

Yes. Pretty output can be indented with two spaces, four spaces or a tab, and Sort keys orders every object’s keys alphabetically at every depth, which makes two documents with the same content line up for a diff. Arrays are never reordered, since in JSON their order is part of the data.

Why is my JSON invalid?

Almost always one of five things: a trailing comma after the last item, single quotes instead of double quotes, unquoted object keys, a comment, or a stray NaN, undefined or Infinity. All are legal JavaScript and none are legal JSON. The error shown is the browser’s own parser message, with the line and column added whenever the browser reports where it gave up, so start there and work outwards.

What is the difference between formatting and validating?

Validating answers whether the text is JSON at all; formatting changes how it is laid out. They happen together here, because a parser has to read the whole document before it can re-print it — if you get formatted output, the document was valid by definition.

Does formatting change my data?

Not the values, with the exceptions every JavaScript-based formatter shares. Numbers are re-printed in their shortest form, so 1.0 comes out as 1 and 1e2 as 100; an integer above 9007199254740991 (2^53 − 1) is rounded, and the tool warns you under the output when the input holds one; a key that appears twice in the same object keeps only its last value; and keys that look like whole numbers are listed first, in numeric order. Keys, strings, booleans and nesting come through exactly as they were.

Can it handle a large JSON file?

A few megabytes is fine on a normal machine, since the work is a single native parse and re-serialise. Very large documents — tens of megabytes — will make the browser tab work hard, because the whole structure has to be held in memory at once; for those, a streaming tool such as jq is the better instrument.

Is my JSON uploaded to a server?

No. The whole tool is JavaScript running in your own browser, so nothing you type or paste is sent over the network, written to a log or attached to an analytics event. You can confirm it by opening the network tab and watching it stay empty while you work.

oktools

Privacy PolicyAbout UsFAQ