JSON Formatter
Paste JSON to format, minify, or validate it locally.
JSON Formatter — what it does
Format JSON into indented, readable structure, minify it back to a single line, or validate it and find out exactly where it breaks. Most JSON problems are a missing comma or a stray trailing one, and a validator that points at the position saves the squinting.
When this tool helps
- Making an API response readable while debugging a request.
- Finding the syntax error in a configuration file that an application refuses to load.
- Minifying a JSON payload before embedding it in code or sending it over the wire.
How to use it
- Paste the JSON into the input box.
- Choose format, minify or validate.
- Read the output or the validation message.
- Copy the result back into your file or request.
Accuracy, limits, and good practice
- JSON forbids trailing commas and comments, which is why files copied from JavaScript so often fail to parse.
- Keys must be in double quotes — single quotes are valid JavaScript and invalid JSON, and this trips up hand-written payloads constantly.
- Formatting does not change meaning: key order and whitespace carry no semantics, so a reformatted document is the same document.
Frequently asked questions
Why is my JSON invalid when it looks fine?
Usually a trailing comma, a single-quoted string, an unquoted key, or a smart quote pasted in from a word processor.
Is my data sent to a server?
No. Parsing and formatting happen entirely in your browser, which matters when the payload contains anything sensitive.
Should I minify JSON for production?
For payloads sent over the network, yes. For configuration files a human maintains, readability is worth far more than the bytes.
Related tools on this site
- Percentage Calculator — Calculate percentages, change, and differences
- Convert Image Format — Convert images to JPG, PNG, or WebP
- PDF Form Filler — Load AcroForm fields, enter values, and export a filled or flattened PDF
Everything above runs inside this page. JSON Formatter needs no account, no upload, and no server round trip — close the tab and nothing is left behind.
JSON 格式化能做什麼
把 JSON 排成有縮排、易讀的結構,壓回單行,或直接驗證並指出它壞在哪裡。多數 JSON 問題不過是少一個逗號或多一個尾逗號,有個會指出位置的驗證器,就不必再瞇著眼找。
什麼時候用得上
- 除錯請求時,把 API 回應變得可讀。
- 找出應用程式拒絕載入的設定檔中的語法錯誤。
- 把 JSON 載荷壓縮後再嵌進程式碼或送上網路。
使用步驟
- 把 JSON 貼進輸入框。
- 選擇格式化、壓縮或驗證。
- 閱讀輸出或驗證訊息。
- 把結果複製回檔案或請求中。
精確度、限制與實務建議
- JSON 不允許尾逗號與註解,這也是從 JavaScript 複製過來的檔案常常解析失敗的原因。
- 鍵名必須用雙引號——單引號在 JavaScript 合法、在 JSON 非法,手寫載荷極常栽在這裡。
- 格式化不改變意義:鍵順序與空白沒有語意,重排後仍是同一份文件。
常見問題
看起來沒問題,為什麼說我的 JSON 無效?
通常是尾逗號、單引號字串、沒加引號的鍵名,或從文書軟體貼進來的智慧引號。
資料會被送到伺服器嗎?
不會。解析與格式化完全在瀏覽器中進行,載荷含敏感內容時這點很關鍵。
正式環境該壓縮 JSON 嗎?
要透過網路傳送的載荷該壓。人工維護的設定檔則以可讀性優先,遠比省那點位元組值得。
本站相關工具
以上步驟全部在這個頁面內完成,JSON 格式化 不需要註冊、不上傳檔案、也不經過伺服器,關閉分頁後不會留下任何資料。