[{"data":1,"prerenderedAt":1173},["ShallowReactive",2],{"blog-how-to-format-json":3},{"id":4,"title":5,"body":6,"category":1162,"date":1163,"description":1164,"extension":1165,"meta":1166,"navigation":580,"path":1167,"readingTime":277,"seo":1168,"stem":1169,"tool":1170,"updated":1171,"__hash__":1172},"blog\u002Fblog\u002Fhow-to-format-json.md","How to Format JSON: The Complete Guide",{"type":7,"value":8,"toc":1136},"minimark",[9,13,16,21,32,68,96,186,190,193,201,204,332,337,351,356,367,371,378,383,386,392,395,399,402,408,412,415,421,425,435,441,444,448,451,482,486,489,496,528,532,539,544,628,632,639,690,694,718,722,726,838,841,893,897,926,930,1071,1074,1078,1119,1123,1126,1132],[10,11,12],"p",{},"JSON (JavaScript Object Notation) is the most widely used data interchange format on the web. Every REST API, configuration file, and NoSQL database speaks JSON. Yet formatting it correctly — with consistent indentation, valid syntax, and minimal size for production — remains a daily task that trips up developers at every level.",[10,14,15],{},"This guide covers everything you need to know about JSON formatting: what makes JSON valid, how to pretty-print it for readability, how to minify it for performance, and how to catch the syntax errors that waste your debugging time.",[17,18,20],"h2",{"id":19},"what-is-json","What is JSON?",[10,22,23,24,31],{},"JSON is a lightweight text format for structured data. It was derived from JavaScript object literal syntax but is language-independent — every modern programming language has a JSON parser. JSON is defined by ",[25,26,30],"a",{"href":27,"rel":28},"https:\u002F\u002Fdatatracker.ietf.org\u002Fdoc\u002Fhtml\u002Frfc8259",[29],"nofollow","RFC 8259"," and uses six structural characters:",[33,34,35,47,56,62],"ul",{},[36,37,38,42,43,46],"li",{},[39,40,41],"code",{},"{"," and ",[39,44,45],{},"}"," for objects (key-value pairs)",[36,48,49,42,52,55],{},[39,50,51],{},"[",[39,53,54],{},"]"," for arrays (ordered lists)",[36,57,58,61],{},[39,59,60],{},":"," separates keys from values",[36,63,64,67],{},[39,65,66],{},","," separates elements",[10,69,70,71,75,76,79,80,83,84,87,88,91,92,95],{},"JSON supports four primitive types: ",[72,73,74],"strong",{},"strings"," (double-quoted), ",[72,77,78],{},"numbers"," (integer or floating-point), ",[72,81,82],{},"booleans"," (",[39,85,86],{},"true"," \u002F ",[39,89,90],{},"false","), and ",[72,93,94],{},"null",".",[97,98,103],"pre",{"className":99,"code":100,"language":101,"meta":102,"style":102},"language-json shiki shiki-themes github-light github-dark","{\n  \"name\": \"StackCache\",\n  \"version\": 2,\n  \"tools\": 42,\n  \"openSource\": false,\n  \"description\": null\n}\n","json","",[39,104,105,114,131,144,157,169,180],{"__ignoreMap":102},[106,107,110],"span",{"class":108,"line":109},"line",1,[106,111,113],{"class":112},"sVt8B","{\n",[106,115,117,121,124,128],{"class":108,"line":116},2,[106,118,120],{"class":119},"sj4cs","  \"name\"",[106,122,123],{"class":112},": ",[106,125,127],{"class":126},"sZZnC","\"StackCache\"",[106,129,130],{"class":112},",\n",[106,132,134,137,139,142],{"class":108,"line":133},3,[106,135,136],{"class":119},"  \"version\"",[106,138,123],{"class":112},[106,140,141],{"class":119},"2",[106,143,130],{"class":112},[106,145,147,150,152,155],{"class":108,"line":146},4,[106,148,149],{"class":119},"  \"tools\"",[106,151,123],{"class":112},[106,153,154],{"class":119},"42",[106,156,130],{"class":112},[106,158,160,163,165,167],{"class":108,"line":159},5,[106,161,162],{"class":119},"  \"openSource\"",[106,164,123],{"class":112},[106,166,90],{"class":119},[106,168,130],{"class":112},[106,170,172,175,177],{"class":108,"line":171},6,[106,173,174],{"class":119},"  \"description\"",[106,176,123],{"class":112},[106,178,179],{"class":119},"null\n",[106,181,183],{"class":108,"line":182},7,[106,184,185],{"class":112},"}\n",[17,187,189],{"id":188},"why-format-json","Why Format JSON?",[10,191,192],{},"Unformatted JSON is a single line of text. This is efficient for machines but unreadable for humans:",[97,194,199],{"className":195,"code":197,"language":198},[196],"language-text","{\"users\":[{\"id\":1,\"name\":\"Alice\",\"roles\":[\"admin\",\"editor\"]},{\"id\":2,\"name\":\"Bob\",\"roles\":[\"viewer\"]}]}\n","text",[39,200,197],{"__ignoreMap":102},[10,202,203],{},"Formatted (pretty-printed) JSON adds indentation and line breaks so you can see the structure:",[97,205,207],{"className":99,"code":206,"language":101,"meta":102,"style":102},"{\n  \"users\": [\n    {\n      \"id\": 1,\n      \"name\": \"Alice\",\n      \"roles\": [\"admin\", \"editor\"]\n    },\n    {\n      \"id\": 2,\n      \"name\": \"Bob\",\n      \"roles\": [\"viewer\"]\n    }\n  ]\n}\n",[39,208,209,213,221,226,238,250,270,275,280,291,303,315,321,327],{"__ignoreMap":102},[106,210,211],{"class":108,"line":109},[106,212,113],{"class":112},[106,214,215,218],{"class":108,"line":116},[106,216,217],{"class":119},"  \"users\"",[106,219,220],{"class":112},": [\n",[106,222,223],{"class":108,"line":133},[106,224,225],{"class":112},"    {\n",[106,227,228,231,233,236],{"class":108,"line":146},[106,229,230],{"class":119},"      \"id\"",[106,232,123],{"class":112},[106,234,235],{"class":119},"1",[106,237,130],{"class":112},[106,239,240,243,245,248],{"class":108,"line":159},[106,241,242],{"class":119},"      \"name\"",[106,244,123],{"class":112},[106,246,247],{"class":126},"\"Alice\"",[106,249,130],{"class":112},[106,251,252,255,258,261,264,267],{"class":108,"line":171},[106,253,254],{"class":119},"      \"roles\"",[106,256,257],{"class":112},": [",[106,259,260],{"class":126},"\"admin\"",[106,262,263],{"class":112},", ",[106,265,266],{"class":126},"\"editor\"",[106,268,269],{"class":112},"]\n",[106,271,272],{"class":108,"line":182},[106,273,274],{"class":112},"    },\n",[106,276,278],{"class":108,"line":277},8,[106,279,225],{"class":112},[106,281,283,285,287,289],{"class":108,"line":282},9,[106,284,230],{"class":119},[106,286,123],{"class":112},[106,288,141],{"class":119},[106,290,130],{"class":112},[106,292,294,296,298,301],{"class":108,"line":293},10,[106,295,242],{"class":119},[106,297,123],{"class":112},[106,299,300],{"class":126},"\"Bob\"",[106,302,130],{"class":112},[106,304,306,308,310,313],{"class":108,"line":305},11,[106,307,254],{"class":119},[106,309,257],{"class":112},[106,311,312],{"class":126},"\"viewer\"",[106,314,269],{"class":112},[106,316,318],{"class":108,"line":317},12,[106,319,320],{"class":112},"    }\n",[106,322,324],{"class":108,"line":323},13,[106,325,326],{"class":112},"  ]\n",[106,328,330],{"class":108,"line":329},14,[106,331,185],{"class":112},[10,333,334],{},[72,335,336],{},"When to pretty-print:",[33,338,339,342,345,348],{},[36,340,341],{},"Debugging API responses",[36,343,344],{},"Reading configuration files",[36,346,347],{},"Code reviews and documentation",[36,349,350],{},"Comparing two JSON payloads",[10,352,353],{},[72,354,355],{},"When to minify:",[33,357,358,361,364],{},[36,359,360],{},"Sending data over the network (API responses, webhooks)",[36,362,363],{},"Storing in databases or caches",[36,365,366],{},"Embedding in HTML or JavaScript bundles",[17,368,370],{"id":369},"common-json-syntax-errors","Common JSON Syntax Errors",[10,372,373,374,377],{},"These are the mistakes that cause ",[39,375,376],{},"JSON.parse()"," to throw and APIs to return 400 errors:",[379,380,382],"h3",{"id":381},"_1-trailing-commas","1. Trailing commas",[10,384,385],{},"JSON does not allow trailing commas. JavaScript does, which is why this catches people:",[97,387,390],{"className":388,"code":389,"language":198},[196],"\u002F\u002F INVALID JSON\n{\n  \"name\": \"Alice\",\n  \"role\": \"admin\",  ← trailing comma\n}\n",[39,391,389],{"__ignoreMap":102},[10,393,394],{},"Remove the comma after the last property or array element.",[379,396,398],{"id":397},"_2-single-quotes","2. Single quotes",[10,400,401],{},"JSON requires double quotes for strings. Single quotes are not valid:",[97,403,406],{"className":404,"code":405,"language":198},[196],"\u002F\u002F INVALID JSON\n{'name': 'Alice'}\n\n\u002F\u002F VALID JSON\n{\"name\": \"Alice\"}\n",[39,407,405],{"__ignoreMap":102},[379,409,411],{"id":410},"_3-unquoted-keys","3. Unquoted keys",[10,413,414],{},"JavaScript allows unquoted object keys, but JSON does not:",[97,416,419],{"className":417,"code":418,"language":198},[196],"\u002F\u002F INVALID JSON\n{name: \"Alice\"}\n\n\u002F\u002F VALID JSON\n{\"name\": \"Alice\"}\n",[39,420,418],{"__ignoreMap":102},[379,422,424],{"id":423},"_4-comments","4. Comments",[10,426,427,428,42,431,434],{},"JSON has no comment syntax. ",[39,429,430],{},"\u002F\u002F",[39,432,433],{},"\u002F* *\u002F"," are not valid:",[97,436,439],{"className":437,"code":438,"language":198},[196],"\u002F\u002F INVALID JSON\n{\n  \"debug\": true  \u002F\u002F enable debug mode\n}\n",[39,440,438],{"__ignoreMap":102},[10,442,443],{},"If you need comments in configuration, consider JSONC (JSON with Comments) or YAML, which support them natively.",[379,445,447],{"id":446},"_5-wrong-value-types","5. Wrong value types",[10,449,450],{},"These JavaScript values are not valid in JSON:",[33,452,453,462,473,476],{},[36,454,455,458,459,461],{},[39,456,457],{},"undefined"," — use ",[39,460,94],{}," instead",[36,463,464,42,467,470,471],{},[39,465,466],{},"NaN",[39,468,469],{},"Infinity"," — use strings or ",[39,472,94],{},[36,474,475],{},"Functions — not representable in JSON",[36,477,478,481],{},[39,479,480],{},"Date"," objects — serialize as ISO 8601 strings",[17,483,485],{"id":484},"how-to-format-json-in-your-browser","How to Format JSON in Your Browser",[10,487,488],{},"The fastest way to format JSON is with a browser-based tool. Paste your JSON, and it instantly validates the syntax, highlights errors with line numbers, and formats the output with your chosen indentation.",[10,490,491,495],{},[25,492,494],{"href":493},"\u002Ftools\u002Fjson-formatter","StackCache JSON Formatter"," runs entirely in your browser — your data never leaves your device. It supports:",[33,497,498,504,510,516,522],{},[36,499,500,503],{},[72,501,502],{},"Pretty-print"," with 2-space or 4-space indentation",[36,505,506,509],{},[72,507,508],{},"Minify"," to remove all whitespace",[36,511,512,515],{},[72,513,514],{},"Validate"," with precise error messages pointing to the exact character",[36,517,518,521],{},[72,519,520],{},"Tree view"," for navigating large payloads",[36,523,524,527],{},[72,525,526],{},"Copy"," formatted output to clipboard",[17,529,531],{"id":530},"how-to-format-json-from-the-command-line","How to Format JSON from the Command Line",[379,533,535,536],{"id":534},"using-jq","Using ",[39,537,538],{},"jq",[10,540,541,543],{},[39,542,538],{}," is the standard command-line JSON processor:",[97,545,549],{"className":546,"code":547,"language":548,"meta":102,"style":102},"language-bash shiki shiki-themes github-light github-dark","# Pretty-print\necho '{\"name\":\"Alice\"}' | jq .\n\n# Minify\necho '{\"name\": \"Alice\"}' | jq -c .\n\n# Format a file\njq . input.json > formatted.json\n","bash",[39,550,551,557,576,582,587,603,607,612],{"__ignoreMap":102},[106,552,553],{"class":108,"line":109},[106,554,556],{"class":555},"sJ8bj","# Pretty-print\n",[106,558,559,562,565,569,573],{"class":108,"line":116},[106,560,561],{"class":119},"echo",[106,563,564],{"class":126}," '{\"name\":\"Alice\"}'",[106,566,568],{"class":567},"szBVR"," |",[106,570,572],{"class":571},"sScJk"," jq",[106,574,575],{"class":126}," .\n",[106,577,578],{"class":108,"line":133},[106,579,581],{"emptyLinePlaceholder":580},true,"\n",[106,583,584],{"class":108,"line":146},[106,585,586],{"class":555},"# Minify\n",[106,588,589,591,594,596,598,601],{"class":108,"line":159},[106,590,561],{"class":119},[106,592,593],{"class":126}," '{\"name\": \"Alice\"}'",[106,595,568],{"class":567},[106,597,572],{"class":571},[106,599,600],{"class":119}," -c",[106,602,575],{"class":126},[106,604,605],{"class":108,"line":171},[106,606,581],{"emptyLinePlaceholder":580},[106,608,609],{"class":108,"line":182},[106,610,611],{"class":555},"# Format a file\n",[106,613,614,616,619,622,625],{"class":108,"line":277},[106,615,538],{"class":571},[106,617,618],{"class":126}," .",[106,620,621],{"class":126}," input.json",[106,623,624],{"class":567}," >",[106,626,627],{"class":126}," formatted.json\n",[379,629,631],{"id":630},"using-python","Using Python",[10,633,634,635,638],{},"Python's ",[39,636,637],{},"json.tool"," module formats JSON from the command line:",[97,640,642],{"className":546,"code":641,"language":548,"meta":102,"style":102},"# Pretty-print\necho '{\"name\":\"Alice\"}' | python -m json.tool\n\n# With custom indentation\npython -c \"import json,sys; print(json.dumps(json.load(sys.stdin), indent=4))\" \u003C input.json\n",[39,643,644,648,665,669,674],{"__ignoreMap":102},[106,645,646],{"class":108,"line":109},[106,647,556],{"class":555},[106,649,650,652,654,656,659,662],{"class":108,"line":116},[106,651,561],{"class":119},[106,653,564],{"class":126},[106,655,568],{"class":567},[106,657,658],{"class":571}," python",[106,660,661],{"class":119}," -m",[106,663,664],{"class":126}," json.tool\n",[106,666,667],{"class":108,"line":133},[106,668,581],{"emptyLinePlaceholder":580},[106,670,671],{"class":108,"line":146},[106,672,673],{"class":555},"# With custom indentation\n",[106,675,676,679,681,684,687],{"class":108,"line":159},[106,677,678],{"class":571},"python",[106,680,600],{"class":119},[106,682,683],{"class":126}," \"import json,sys; print(json.dumps(json.load(sys.stdin), indent=4))\"",[106,685,686],{"class":567}," \u003C",[106,688,689],{"class":126}," input.json\n",[379,691,693],{"id":692},"using-nodejs","Using Node.js",[97,695,697],{"className":546,"code":696,"language":548,"meta":102,"style":102},"# Pretty-print\nnode -e \"process.stdin.resume(); let d=''; process.stdin.on('data',c=>d+=c); process.stdin.on('end',()=>console.log(JSON.stringify(JSON.parse(d),null,2)))\" \u003C input.json\n",[39,698,699,703],{"__ignoreMap":102},[106,700,701],{"class":108,"line":109},[106,702,556],{"class":555},[106,704,705,708,711,714,716],{"class":108,"line":116},[106,706,707],{"class":571},"node",[106,709,710],{"class":119}," -e",[106,712,713],{"class":126}," \"process.stdin.resume(); let d=''; process.stdin.on('data',c=>d+=c); process.stdin.on('end',()=>console.log(JSON.stringify(JSON.parse(d),null,2)))\"",[106,715,686],{"class":567},[106,717,689],{"class":126},[17,719,721],{"id":720},"json-formatting-in-code","JSON Formatting in Code",[379,723,725],{"id":724},"javascript-typescript","JavaScript \u002F TypeScript",[97,727,731],{"className":728,"code":729,"language":730,"meta":102,"style":102},"language-javascript shiki shiki-themes github-light github-dark","\u002F\u002F Pretty-print with 2-space indent\nconst formatted = JSON.stringify(data, null, 2);\n\n\u002F\u002F Minify\nconst minified = JSON.stringify(data);\n\n\u002F\u002F Custom replacer to filter keys\nconst filtered = JSON.stringify(data, ['name', 'email'], 2);\n","javascript",[39,732,733,738,769,773,778,796,800,805],{"__ignoreMap":102},[106,734,735],{"class":108,"line":109},[106,736,737],{"class":555},"\u002F\u002F Pretty-print with 2-space indent\n",[106,739,740,743,746,749,752,754,757,760,762,764,766],{"class":108,"line":116},[106,741,742],{"class":567},"const",[106,744,745],{"class":119}," formatted",[106,747,748],{"class":567}," =",[106,750,751],{"class":119}," JSON",[106,753,95],{"class":112},[106,755,756],{"class":571},"stringify",[106,758,759],{"class":112},"(data, ",[106,761,94],{"class":119},[106,763,263],{"class":112},[106,765,141],{"class":119},[106,767,768],{"class":112},");\n",[106,770,771],{"class":108,"line":133},[106,772,581],{"emptyLinePlaceholder":580},[106,774,775],{"class":108,"line":146},[106,776,777],{"class":555},"\u002F\u002F Minify\n",[106,779,780,782,785,787,789,791,793],{"class":108,"line":159},[106,781,742],{"class":567},[106,783,784],{"class":119}," minified",[106,786,748],{"class":567},[106,788,751],{"class":119},[106,790,95],{"class":112},[106,792,756],{"class":571},[106,794,795],{"class":112},"(data);\n",[106,797,798],{"class":108,"line":171},[106,799,581],{"emptyLinePlaceholder":580},[106,801,802],{"class":108,"line":182},[106,803,804],{"class":555},"\u002F\u002F Custom replacer to filter keys\n",[106,806,807,809,812,814,816,818,820,823,826,828,831,834,836],{"class":108,"line":277},[106,808,742],{"class":567},[106,810,811],{"class":119}," filtered",[106,813,748],{"class":567},[106,815,751],{"class":119},[106,817,95],{"class":112},[106,819,756],{"class":571},[106,821,822],{"class":112},"(data, [",[106,824,825],{"class":126},"'name'",[106,827,263],{"class":112},[106,829,830],{"class":126},"'email'",[106,832,833],{"class":112},"], ",[106,835,141],{"class":119},[106,837,768],{"class":112},[379,839,840],{"id":678},"Python",[97,842,845],{"className":843,"code":844,"language":678,"meta":102,"style":102},"language-python shiki shiki-themes github-light github-dark","import json\n\n# Pretty-print\nformatted = json.dumps(data, indent=2, ensure_ascii=False)\n\n# Minify (remove extra whitespace)\nminified = json.dumps(data, separators=(',', ':'))\n\n# Sort keys for deterministic output\nsorted_json = json.dumps(data, indent=2, sort_keys=True)\n",[39,846,847,852,856,860,865,869,874,879,883,888],{"__ignoreMap":102},[106,848,849],{"class":108,"line":109},[106,850,851],{},"import json\n",[106,853,854],{"class":108,"line":116},[106,855,581],{"emptyLinePlaceholder":580},[106,857,858],{"class":108,"line":133},[106,859,556],{},[106,861,862],{"class":108,"line":146},[106,863,864],{},"formatted = json.dumps(data, indent=2, ensure_ascii=False)\n",[106,866,867],{"class":108,"line":159},[106,868,581],{"emptyLinePlaceholder":580},[106,870,871],{"class":108,"line":171},[106,872,873],{},"# Minify (remove extra whitespace)\n",[106,875,876],{"class":108,"line":182},[106,877,878],{},"minified = json.dumps(data, separators=(',', ':'))\n",[106,880,881],{"class":108,"line":277},[106,882,581],{"emptyLinePlaceholder":580},[106,884,885],{"class":108,"line":282},[106,886,887],{},"# Sort keys for deterministic output\n",[106,889,890],{"class":108,"line":293},[106,891,892],{},"sorted_json = json.dumps(data, indent=2, sort_keys=True)\n",[379,894,896],{"id":895},"go","Go",[97,898,901],{"className":899,"code":900,"language":895,"meta":102,"style":102},"language-go shiki shiki-themes github-light github-dark","\u002F\u002F Pretty-print\nformatted, _ := json.MarshalIndent(data, \"\", \"  \")\n\n\u002F\u002F Minify\nminified, _ := json.Marshal(data)\n",[39,902,903,908,913,917,921],{"__ignoreMap":102},[106,904,905],{"class":108,"line":109},[106,906,907],{},"\u002F\u002F Pretty-print\n",[106,909,910],{"class":108,"line":116},[106,911,912],{},"formatted, _ := json.MarshalIndent(data, \"\", \"  \")\n",[106,914,915],{"class":108,"line":133},[106,916,581],{"emptyLinePlaceholder":580},[106,918,919],{"class":108,"line":146},[106,920,777],{},[106,922,923],{"class":108,"line":159},[106,924,925],{},"minified, _ := json.Marshal(data)\n",[17,927,929],{"id":928},"json-vs-other-formats","JSON vs Other Formats",[931,932,933,955],"table",{},[934,935,936],"thead",{},[937,938,939,943,946,949,952],"tr",{},[940,941,942],"th",{},"Feature",[940,944,945],{},"JSON",[940,947,948],{},"YAML",[940,950,951],{},"XML",[940,953,954],{},"TOML",[956,957,958,975,990,1007,1021,1037,1052],"tbody",{},[937,959,960,964,967,970,973],{},[961,962,963],"td",{},"Human readable",[961,965,966],{},"Good",[961,968,969],{},"Excellent",[961,971,972],{},"Fair",[961,974,969],{},[937,976,977,980,983,986,988],{},[961,978,979],{},"Comments",[961,981,982],{},"No",[961,984,985],{},"Yes",[961,987,985],{},[961,989,985],{},[937,991,992,995,998,1001,1004],{},[961,993,994],{},"Data types",[961,996,997],{},"4 primitives",[961,999,1000],{},"Rich (dates, etc.)",[961,1002,1003],{},"Text only",[961,1005,1006],{},"Rich",[937,1008,1009,1012,1014,1017,1019],{},[961,1010,1011],{},"Trailing commas",[961,1013,982],{},[961,1015,1016],{},"N\u002FA",[961,1018,1016],{},[961,1020,985],{},[937,1022,1023,1026,1029,1032,1035],{},[961,1024,1025],{},"File size",[961,1027,1028],{},"Medium",[961,1030,1031],{},"Small",[961,1033,1034],{},"Large",[961,1036,1031],{},[937,1038,1039,1042,1045,1048,1050],{},[961,1040,1041],{},"Parse speed",[961,1043,1044],{},"Fast",[961,1046,1047],{},"Slow",[961,1049,1028],{},[961,1051,1044],{},[937,1053,1054,1057,1064,1066,1069],{},[961,1055,1056],{},"Browser native",[961,1058,1059,1060,1063],{},"Yes (",[39,1061,1062],{},"JSON.parse",")",[961,1065,982],{},[961,1067,1068],{},"Via DOM",[961,1070,982],{},[10,1072,1073],{},"JSON wins for API communication because every language and browser can parse it natively. YAML wins for configuration files because it supports comments and is more readable. XML wins for document markup and legacy enterprise systems. TOML wins for simple configuration with strict typing.",[17,1075,1077],{"id":1076},"best-practices","Best Practices",[1079,1080,1081,1087,1101,1107,1113],"ol",{},[36,1082,1083,1086],{},[72,1084,1085],{},"Use 2-space indentation"," — it is the most common convention in JavaScript, TypeScript, and web development. 4-space is standard in Python.",[36,1088,1089,1092,1093,1096,1097,1100],{},[72,1090,1091],{},"Sort keys in version-controlled files"," — deterministic key ordering produces clean diffs. ",[39,1094,1095],{},"JSON.stringify(data, null, 2)"," preserves insertion order; use ",[39,1098,1099],{},"sort_keys=True"," (Python) or a custom replacer to sort.",[36,1102,1103,1106],{},[72,1104,1105],{},"Validate before deploying"," — a single syntax error in a JSON config file can take down a service. Always validate in CI.",[36,1108,1109,1112],{},[72,1110,1111],{},"Minify for production APIs"," — removing whitespace from a typical API response reduces size by 15-30%, which matters at scale.",[36,1114,1115,1118],{},[72,1116,1117],{},"Use a schema"," — JSON Schema validates structure, not just syntax. Define required fields, types, and constraints so errors are caught before runtime.",[17,1120,1122],{"id":1121},"summary","Summary",[10,1124,1125],{},"JSON formatting is a simple task with real consequences: unformatted JSON wastes debugging time, invalid JSON breaks APIs, and unminified JSON wastes bandwidth. Use pretty-print for reading, minify for sending, and always validate before deploying.",[10,1127,1128,1131],{},[25,1129,1130],{"href":493},"Try the JSON Formatter"," — it runs locally in your browser, handles files up to 10 MB, and gives you precise error messages when something is wrong.",[1133,1134,1135],"style",{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}",{"title":102,"searchDepth":116,"depth":116,"links":1137},[1138,1139,1140,1147,1148,1154,1159,1160,1161],{"id":19,"depth":116,"text":20},{"id":188,"depth":116,"text":189},{"id":369,"depth":116,"text":370,"children":1141},[1142,1143,1144,1145,1146],{"id":381,"depth":133,"text":382},{"id":397,"depth":133,"text":398},{"id":410,"depth":133,"text":411},{"id":423,"depth":133,"text":424},{"id":446,"depth":133,"text":447},{"id":484,"depth":116,"text":485},{"id":530,"depth":116,"text":531,"children":1149},[1150,1152,1153],{"id":534,"depth":133,"text":1151},"Using jq",{"id":630,"depth":133,"text":631},{"id":692,"depth":133,"text":693},{"id":720,"depth":116,"text":721,"children":1155},[1156,1157,1158],{"id":724,"depth":133,"text":725},{"id":678,"depth":133,"text":840},{"id":895,"depth":133,"text":896},{"id":928,"depth":116,"text":929},{"id":1076,"depth":116,"text":1077},{"id":1121,"depth":116,"text":1122},"Guides","2026-09-08","Learn how to format, validate, and minify JSON with examples. Covers syntax rules, common errors, and when to use each format.","md",{},"\u002Fblog\u002Fhow-to-format-json",{"title":5,"description":1164},"blog\u002Fhow-to-format-json","json-formatter",null,"3Ue8cD25tQQkLh8WWp7qAz127cy79aTa4sT1U9jpn-s",1788868139221]