[{"data":1,"prerenderedAt":98},["ShallowReactive",2],{"json-guide-list-en":3,"json-article-en-json-whitespace-and-size":29},[4,9,14,19,24],{"slug":5,"title":6,"description":7,"eyebrow":8},"fix-invalid-json","How to fix invalid JSON","Diagnose trailing commas, single quotes, comments, malformed strings, and missing brackets in invalid JSON.","ERROR GUIDE",{"slug":10,"title":11,"description":12,"eyebrow":13},"json-minification-explained","JSON minification explained","Learn what JSON minification removes, what data it preserves, and when smaller JSON is useful.","CORE CONCEPT",{"slug":15,"title":16,"description":17,"eyebrow":18},"json-minify-vs-compress","JSON minification vs compression","Compare whitespace minification with gzip and Brotli transport compression for JSON files and API responses.","SIZE COMPARISON",{"slug":20,"title":21,"description":22,"eyebrow":23},"json-whitespace-and-size","How JSON whitespace affects file size","Understand which JSON whitespace can be removed and how to measure realistic byte savings.","SIZE & MEASUREMENT",{"slug":25,"title":26,"description":27,"eyebrow":28},"minify-json-for-production","Minify JSON safely for production","Use a practical checklist to validate, minify, compress, cache, and monitor production JSON assets.","PRODUCTION CHECKLIST",{"id":30,"title":21,"body":31,"description":22,"extension":38,"eyebrow":23,"faqs":39,"intro":49,"meta":50,"navigation":51,"path":52,"relatedGuides":53,"sections":54,"seo":93,"seoTitle":94,"slug":20,"stem":95,"type":96,"__hash__":97},"articles\u002Fen\u002Farticles\u002Fjson-whitespace-and-size.md",{"type":32,"value":33,"toc":34},"minimark",[],{"title":35,"searchDepth":36,"depth":36,"links":37},"",2,[],"md",[40,43,46],{"question":41,"answer":42},"Does working with JSON whitespace and byte size change the underlying data?","It should not change meaning when the operation is purely representational, but parsers may resolve aliases, normalize numbers, drop comments, or choose a different textual style. Compare parsed structures and review the destination’s rules.",{"question":44,"answer":45},"How can I verify the result?","Parse both sides where possible, compare keys and value types, then test the generated result in its real consumer. A visual comparison alone can miss null, number, Boolean, encoding, or duplicate-key differences.",{"question":47,"answer":48},"When should I avoid an automatic conversion?","Avoid unattended conversion when the source uses implementation-specific features, duplicate keys, custom tags, comments that carry operational knowledge, or numeric values whose precision cannot be safely represented.","Pretty-printed JSON trades bytes for readability. The amount saved by minification depends on nesting, indentation, line breaks, and how much of the document is actual string data.",{},true,"\u002Fen\u002Farticles\u002Fjson-whitespace-and-size",[10,15],[55,59,63,67,76,82,87],{"title":56,"paragraphs":57},"Optional whitespace",[58],"Spaces, tabs, carriage returns, and line feeds are optional between JSON tokens. Whitespace inside quoted strings is part of the value and cannot be removed.",{"title":60,"paragraphs":61},"Measure bytes, not characters",[62],"UTF-8 characters can occupy more than one byte. Compare encoded byte length before and after minification, then also inspect Brotli or gzip transfer size for web delivery.",{"title":64,"paragraphs":65},"Small files may save little",[66],"On tiny documents, HTTP headers and connection overhead can exceed whitespace savings. Optimize based on measured delivery and parsing costs.",{"title":68,"paragraphs":69,"bullets":72},"A reliable step-by-step workflow",[70,71],"Treat JSON whitespace and byte size as a data transformation with an explicit input, expected structure, and destination. Work on a copy, validate before changing representation, and isolate the smallest useful sample. This separates syntax failures from data-model or application failures.","Run one change at a time and repeat the same validation after each change. For automated pipelines, fail the job on a parser error instead of publishing a partial or guessed result. Keep the original input beside the generated artifact when traceability matters.",[73,74,75],"Start with a representative input and keep an untouched copy so the transformation can be reviewed or repeated.","Inspect the parsed structure, not only the rendered text; keys, scalar types, array order, and null values are what downstream software receives.","Test the result in the real destination and record any parser, schema, encoding, or formatting assumptions in the project.",{"title":77,"paragraphs":78,"code":81},"Worked example and verification",[79,80],"The compact sample below is intentionally small enough to inspect by eye. Use the same pattern with a real document: confirm every key, scalar type, list order, and nested boundary before accepting the output.","A successful conversion or minification only proves that the source could be parsed. Compare the parsed value before and after the operation, then load the result with the same library or platform that will consume it in production.","bytes = new TextEncoder().encode(jsonText).length",{"title":83,"paragraphs":84},"Limits and edge cases",[85,86],"The difficult cases in JSON whitespace and byte size usually come from differences between syntax validity and application validity. A parser can accept data that is still incomplete, ambiguous, too large, or incompatible with a destination schema.","Never repair or normalize an unfamiliar document blindly. Duplicate keys, implicit types, aliases, precision limits, Unicode, line endings, and very large inputs deserve an explicit policy. When the destination has stricter rules, those rules win.",{"title":88,"paragraphs":89,"bullets":92},"Production checklist",[90,91],"Before release, test a normal document, an empty value, deeply nested data, non-ASCII text, and a deliberately malformed example. Record the tool or library version if another system must reproduce the exact output.","Make validation part of continuous integration when the data affects builds, deployments, APIs, or configuration. Review diffs, keep a rollback copy, and monitor the first consumer after deployment rather than assuming a syntactically valid file is operationally correct.",[73,74,75],{"title":21,"description":22},"JSON Whitespace and File Size — Measure Minification Savings","en\u002Farticles\u002Fjson-whitespace-and-size","guide","KX8OUMbf6fqBRNTTycs342Os721niErz4MvENvG0kTc",1791969046523]