JSON Indentation: 2-Space vs 4-Space vs Tab — What's the Standard?
The definitive guide to JSON indentation standards: 2-space vs 4-space vs tabs. Includes language defaults, linter configs, and team consistency tips.
Published:
Tags: json, developer-tools, formatting
JSON Indentation: 2-Space vs 4-Space vs Tab — What's the Standard? There is no single universal standard for JSON indentation. The JSON spec itself says nothing about it — as far as the spec is concerned, all whitespace outside string values is optional. What matters is consistency within a codebase, and the correct choice often depends on the language ecosystem you're working in. Here's a practical map of what different tools and ecosystems default to, and how to enforce a consistent choice across your team. What the JSON Spec Actually Says RFC 8259, the JSON specification, defines whitespace as any combination of space (0x20), tab (0x09), newline (0x0A), and carriage return (0x0D). It is explicitly insignificant — meaning two JSON documents that differ only in whitespace are…
All articles · theproductguy.in