JSON Formatter & Validator
Pretty-print JSON strings and check for syntax errors.
π How to Use
Paste a JSON string into the input field.
e.g.
{"name":"WebTools","version":1}
Toggle key sorting and adjust indentation (2 or 4 spaces).
Click β¨ Format to pretty-print, or ποΈ Minify to remove whitespace.
Click π Copy to save the formatted JSON to your clipboard.
About the JSON Formatter
JSON (JavaScript Object Notation, RFC 8259) is a lightweight, text-based format for exchanging structured data between systems. Despite the name, it is language-independent and has become the de-facto standard for REST APIs, configuration files, NoSQL document stores such as MongoDB, and serialized application state. This formatter takes any JSON string — whether minified onto a single line, deeply nested, or returned raw from an API response — and re-emits it with consistent indentation so a human can actually read it.
How the formatter works
The tool parses your input with a strict JSON parser (the same grammar a browser uses), so it only accepts syntactically valid JSON. When parsing succeeds, the value is re-serialized with a configurable indent of 2 or 4 spaces and optional alphabetical key sorting. When parsing fails, the tool reports the position of the syntax error instead of silently producing wrong output — which is what makes it a validator as well as a beautifier. Everything runs in your browser through the native JSON.parse / JSON.stringify pipeline; not a byte of your input is transmitted anywhere.
A few rules are worth remembering: JSON requires double-quoted strings (single quotes are invalid), keys must always be strings, and a trailing comma after the last element is a syntax error. Numbers such as 1e3 and 0.5 are valid, but NaN and Infinity are not.
Common use cases
- Pretty-printing a minified API response to inspect nested fields
- Debugging a failing
JSON.parseby locating the exact error position - Normalizing indentation before committing a
.jsonconfig file - Sorting object keys for stable, reviewable diffs in version control
- Shrinking payload size with the Minify action before sending over the network
Worked example
Given minified input:
{"user":"ada","roles":["admin","editor"],"meta":{"active":true,"logins":42}}
Formatting with a 2-space indent (and key sorting on) yields:
{
"meta": {
"active": true,
"logins": 42
},
"roles": [
"admin",
"editor"
],
"user": "ada"
}
Because JSON objects are unordered, reordering keys changes nothing about the meaning of the data — only how it reads.
Frequently asked questions
Is my JSON sent to a server?
No. Parsing and formatting run entirely in your browser through the native JSON.parse / JSON.stringify APIs. Your input never leaves your device, so it is safe for tokens, credentials, and production data.
Why does my JSON show a syntax error?
The most common causes are single quotes instead of double quotes, a trailing comma after the last item, an unquoted key, or a raw control character inside a string. The tool reports the character position so you can jump straight to the mistake.
What is the difference between Format and Minify?
Format adds indentation and newlines for readability. Minify removes all optional whitespace to produce the smallest valid string, which is ideal for transmission and storage.
Does sorting keys change the data?
No. JSON objects are unordered by specification, so reordering keys never changes meaning. Sorting only produces stable, diff-friendly output.
Is there a maximum input size?
There is no artificial limit, but very large documents (tens of MB) can freeze the tab while parsing. For multi-gigabyte files, a streaming parser is a better fit than an in-browser formatter.
JSON ν¬λ§€ν°λ?
JSON(JavaScript Object Notation, RFC 8259)μ μμ€ν κ°μ ꡬ쑰νλ λ°μ΄ν°λ₯Ό μ£Όκ³ λ°κΈ° μν κ°λ³κ³ ν μ€νΈ κΈ°λ°μ νμμ λλ€. μ΄λ¦κ³Ό λ¬λ¦¬ μΈμ΄μ λ 립μ μ΄λ©°, REST API, μ€μ νμΌ, MongoDB κ°μ NoSQL λ¬Έμ μ μ₯μ, μ§λ ¬νλ μ ν리μΌμ΄μ μν λ±μμ μ¬μ€μ νμ€μΌλ‘ μ리 μ‘μμ΅λλ€. μ΄ ν¬λ§€ν°λ ν μ€λ‘ μμΆλμκ±°λ κΉκ² μ€μ²©λμκ±°λ API μλ΅μΌλ‘ κ·Έλλ‘ λ΄λ €μ¨ μ΄λ€ JSON λ¬Έμμ΄μ΄λ μΌκ΄λ λ€μ¬μ°κΈ°λ‘ λ€μ μΆλ ₯ν΄ μ¬λμ΄ μ½μ μ μκ² λ§λ€μ΄ μ€λλ€.
μλ λ°©μ
μ΄ λꡬλ μ
λ ₯μ μ격ν JSON νμ(λΈλΌμ°μ κ° μ¬μ©νλ κ²κ³Ό κ°μ λ¬Έλ²)λ‘ λΆμνλ―λ‘, λ¬Έλ²μ μΌλ‘ μ ν¨ν JSONλ§ λ°μλ€μ
λλ€. νμ±μ μ±κ³΅νλ©΄ κ°μ 2μΉΈ λλ 4μΉΈμ κ΅¬μ± κ°λ₯ν λ€μ¬μ°κΈ°μ μ νμ ν€ μνλ²³ μ λ ¬λ‘ λ€μ μ§λ ¬νν©λλ€. νμ±μ μ€ν¨νλ©΄ μλͺ»λ κ²°κ³Όλ₯Ό μ‘°μ©ν λ΄λ λμ ꡬ문 μ€λ₯μ μμΉλ₯Ό μλ € μ€λλ€ — λλΆμ κ²μ¦κΈ° μν λ ν¨κ» ν©λλ€. λͺ¨λ μ²λ¦¬λ λΈλΌμ°μ μμμ λ€μ΄ν°λΈ JSON.parse / JSON.stringify νμ΄νλΌμΈμΌλ‘ μ΄λ£¨μ΄μ§λ©°, μ
λ ₯μ μ΄λ€ λ°μ΄νΈλ μΈλΆλ‘ μ μ‘λμ§ μμ΅λλ€.
λͺ κ°μ§ κ·μΉμ κΈ°μ΅ν΄ λλ©΄ μ’μ΅λλ€. JSONμ ν°λ°μ΄ν λ¬Έμμ΄λ§ νμ©ν©λλ€(μμλ°μ΄νλ μλͺ»λ¨). ν€λ νμ λ¬Έμμ΄μ΄μ΄μΌ νλ©°, λ§μ§λ§ μμ λ€μ νν μΌνλ ꡬ문 μ€λ₯μ
λλ€. 1e3μ΄λ 0.5 κ°μ μ«μλ μ ν¨νμ§λ§ NaNκ³Ό Infinityλ μ ν¨νμ§ μμ΅λλ€.
μμ£Ό μ°λ κ²½μ°
- μ΅μνλ API μλ΅μ 보기 μ’κ² νΌμ³ μ€μ²© νλ νμΈνκΈ°
- μ€ν¨ν
JSON.parseμ μ νν μ€λ₯ μμΉλ₯Ό μ°Ύμ λλ²κΉ νκΈ° .jsonμ€μ νμΌμ 컀λ°νκΈ° μ λ€μ¬μ°κΈ° ν΅μΌνκΈ°- λ²μ κ΄λ¦¬μμ μμ μ μ΄κ³ κ²ν νκΈ° μ¬μ΄ diffλ₯Ό μν΄ κ°μ²΄ ν€ μ λ ¬νκΈ°
- λ€νΈμν¬ μ μ‘ μ μ Minify λμμΌλ‘ νμ΄λ‘λ ν¬κΈ° μ€μ΄κΈ°
μ¬μ© μ
μ΅μνλ μ λ ₯μ΄ μ£Όμ΄μ§λ©΄:
{"user":"ada","roles":["admin","editor"],"meta":{"active":true,"logins":42}}
2μΉΈ λ€μ¬μ°κΈ°(ν€ μ λ ¬ μΌμ§)λ‘ ν¬λ§·νλ©΄:
{
"meta": {
"active": true,
"logins": 42
},
"roles": [
"admin",
"editor"
],
"user": "ada"
}
JSON κ°μ²΄λ μμκ° μμΌλ―λ‘ ν€λ₯Ό μ¬μ λ ¬ν΄λ λ°μ΄ν°μ μλ―Έλ λ¬λΌμ§μ§ μμ΅λλ€ — λ¬λΌμ§λ κ²μ μ½λ λ°©μλΏμ λλ€.
μμ£Ό 묻λ μ§λ¬Έ
μ JSONμ΄ μλ²λ‘ μ μ‘λλμ?
μλλλ€. νμ±κ³Ό ν¬λ§·μ μ μ μΌλ‘ λΈλΌμ°μ μμ λ€μ΄ν°λΈ JSON.parse / JSON.stringify APIλ‘ μ²λ¦¬λ©λλ€. μ
λ ₯μ κΈ°κΈ°λ₯Ό λ λμ§ μμΌλ―λ‘ ν ν°, μ격μ¦λͺ
, μ΄μ λ°μ΄ν°μλ μμ ν©λλ€.
JSONμμ ꡬ문 μ€λ₯κ° λλ μ΄μ λ?
κ°μ₯ νν μμΈμ ν°λ°μ΄ν λμ μμλ°μ΄ν, λ§μ§λ§ νλͺ© λ€μ νν μΌν, λ°μ΄ν μλ ν€, λ¬Έμμ΄ μμ μ μ΄ λ¬Έμμ λλ€. λκ΅¬κ° λ¬Έμ μμΉλ₯Ό μλ € μ£Όμ΄ ν΄λΉ μμΉλ‘ λ°λ‘ μ΄λν μ μμ΅λλ€.
Formatκ³Ό Minifyμ μ°¨μ΄λ?
Formatμ κ°λ μ±μ μν΄ λ€μ¬μ°κΈ°μ μ€λ°κΏμ μΆκ°ν©λλ€. Minifyλ μ μ‘κ³Ό μ μ₯μ μ ν©ν κ°μ₯ μμ μ ν¨ λ¬Έμμ΄μ λ§λ€κΈ° μν΄ λͺ¨λ μ νμ 곡백μ μ κ±°ν©λλ€.
ν€ μ λ ¬μ΄ λ°μ΄ν°λ₯Ό λ°κΎΈλμ?
μλλλ€. JSON κ°μ²΄λ μ¬μμ μμκ° μμΌλ―λ‘ ν€ μμλ₯Ό λ°κΏλ μλ―Έλ λ³νμ§ μμ΅λλ€. μ λ ¬μ μμ μ μ΄κ³ diffνκΈ° μ¬μ΄ μΆλ ₯μ λ§λ€ λΏμ λλ€.
μ΅λ μ λ ₯ ν¬κΈ°κ° μλμ?
μΈμμ μΈ μ νμ μμ§λ§, μμ£Ό ν° λ¬Έμ(μμ MB)λ νμ± μ€ νμ λ©μΆκ² ν μ μμ΅λλ€. μ GB νμΌμλ λΈλΌμ°μ λ΄ ν¬λ§€ν°λ³΄λ€ μ€νΈλ¦¬λ° νμκ° λ μ ν©ν©λλ€.