Beautify, indent, validate, sort keys, and minify JSON data locally
Format unreadable JSON into clean, indented structure (2 or 4 spaces), validate RFC 8259 syntax, sort object keys alphabetically, or minify for compact payloads.
JSON (JavaScript Object Notation, standardized under RFC 8259 and ECMA-404) is the universal text-based data interchange format used by REST APIs, configuration files, and NoSQL databases. Standard JSON supports exactly six data types: Objects (unordered key-value collections wrapped in curly braces `{}`), Arrays (ordered lists wrapped in square brackets `[]`), Strings (Unicode characters enclosed strictly in double quotes `""`), Numbers (base-10 integers or floating-point values without leading zeros, `NaN`, or `Infinity`), Booleans (`true` or `false` in lowercase), and `null`. Our JSON Formatter parses raw or single-line payloads in your browser and lets you Beautify with 2-space or 4-space indentation, Minify (strip all non-essential whitespace to reduce payload bytes), Sort Keys A–Z recursively across nested objects for clean git diffs, or download the output as a `.json` file.
Because the official JSON grammar is deliberately strict, small syntax mistakes that are legal in JavaScript objects will cause `JSON.parse()` to fail. The most frequent errors include trailing commas after the last item in an object or array (for example, `{"id": 1,}`), wrapping keys or strings in single quotes (`'name'`) or leaving object keys unquoted (`{name: "Admin"}`), including `//` or `/* */` comments (which standard JSON does not allow), leaving raw unescaped newline or tab characters inside a string literal, and mismatched closing brackets (`}` vs `]`). When your input contains malformed syntax, this tool catches the parser exception and displays the exact engine error message so you can fix the offending token.
Important Technical Distinction: You must distinguish between JSON syntax validation (which this tool performs) and JSON Schema validation. Syntax validation only verifies that your text follows valid RFC 8259 grammar rules so a parser can deserialize it into memory. It does NOT verify business logic or data contracts—such as whether an `"email"` field contains a valid email address, whether a required `"userId"` property is missing, or whether `"price"` is a number instead of a string (which requires a separate JSON Schema validator). Additionally, note two standard browser `JSON.parse()` behaviors: if an object contains duplicate keys (such as `{"a": 1, "a": 2}`), the parser silently overwrites earlier keys with the last value (`2`), and integers larger than `Number.MAX_SAFE_INTEGER` (9,007,199,254,740,991 or $2^{53} - 1$) lose exact precision unless stored as strings.
जेसन (JSON - JavaScript Object Notation, जो RFC 8259 और ECMA-404 मानक पर आधारित है) वेब एपीआई (REST APIs), कॉन्फ़िगरेशन फाइलों और डेटाबेस के बीच डेटा के आदान-प्रदान का सबसे प्रचलित टेक्स्ट फॉर्मेट है। मानक JSON में केवल छह प्रकार के डेटा (Data Types) मान्य होते हैं: ऑब्जेक्ट्स (कर्ली ब्रैकेट `{}` में बंद कुंजी-मान जोड़े), एरे (स्क्वायर ब्रैकेट `[]` में बंद क्रमबद्ध सूचियां), स्ट्रिंग्स (हमेशा डबल कोट्स `""` में बंद टेक्स्ट), नंबर्स (दशमलव या पूर्णांक संख्याएं, जिनमें आगे शून्य, `NaN` या `Infinity` की अनुमति नहीं होती), बूलियन (छोटे अक्षरों में `true` या `false`), और `null`। हमारा JSON फॉर्मेटर आपके ब्राउज़र में ही डेटा को पार्स करके 2 या 4 स्पेस के इंडेंटेशन के साथ सुंदर (Beautify) बनाता है, फाइल साइज घटाने के लिए मिनिफाई (Minify) करता है, नेस्टेड ऑब्जेक्ट्स की कीज़ को A–Z क्रम (Sort Keys) में लगाता है, और `.json` फाइल डाउनलोड करने की सुविधा देता है।
JSON का सिंटैक्स बहुत सख्त होता है, इसलिए जावास्क्रिप्ट में चलने वाली कई सामान्य आदतें JSON में एरर (Syntax Error) पैदा कर देती हैं। सबसे आम गलतियों में किसी ऑब्जेक्ट या एरे के आखिरी आइटम के बाद कॉमा छोड़ देना (Trailing Comma, जैसे `{"id": 1,}`), डबल कोट्स के बजाय सिंगल कोट्स (`'name'`) लगाना या ऑब्जेक्ट कीज़ को बिना कोट्स के लिखना (`{name: "Admin"}`), कोड के बीच में `//` या `/* */` कमेंट्स लिखना (मानक JSON में कमेंट्स वर्जित हैं), और ब्रैकेट्स (`{}` या `[]`) को सही क्रम में बंद न करना शामिल है। यदि आपके डेटा में ऐसी कोई गलती होती है, तो यह टूल तुरंत पार्सर का एरर संदेश दिखाता है।
महत्वपूर्ण तकनीकी अंतर: 'JSON सिंटैक्स वैलिडेशन' और 'JSON स्कीमा (Schema) वैलिडेशन' के बीच का अंतर समझना आवश्यक है। यह टूल सिंटैक्स की जांच करता है—अर्थात् यह देखता है कि ब्रैकेट, कोट्स और डेटा प्रकार RFC 8259 नियमों के अनुसार सही लिखे गए हैं या नहीं। लेकिन यह आपके व्यावसायिक नियमों (Schema Validation) की जांच नहीं करता, जैसे कि किसी `"email"` फील्ड में वास्तव में ईमेल लिखा है या नहीं, या कोई जरूरी फील्ड छूट तो नहीं गया है। इसके अलावा, ब्राउज़र के मानक `JSON.parse()` की दो सीमाएं ध्यान में रखें: यदि किसी ऑब्जेक्ट में एक ही नाम की दो डुप्लीकेट कीज़ (`{"a": 1, "a": 2}`) हैं, तो पार्सर बिना चेतावनी दिए केवल आखिरी मान (`2`) को रखता है; और 16 अंकों से बड़ी पूर्णांक संख्याएं (`Number.MAX_SAFE_INTEGER` यानी $2^{53} - 1$ से बड़े ID नंबर) सटीकता खो सकती हैं, इसलिए उन्हें स्ट्रिंग के रूप में रखना चाहिए।