Developer topics · Updated 2026-10-04
JSON Formatting and Validation: Complete Guide
JSON is a text format for structured data: objects, arrays, strings, numbers, booleans, and null. Formatting and validation are two sides of the same coin—if the text does not parse, it is not JSON yet, no matter how it looks.
What counts as JSON
- Property names must be double-quoted strings.
- Strings use double quotes, not single quotes.
- No comments and no trailing commas.
- Numbers are base-10 decimals (no leading zeros as octal, no NaN/Infinity in strict JSON).
- A document is one value—usually an object or array—not multiple top-level values.
Formatting (pretty-print)
A formatter parses the text into a value, then prints it again with consistent indentation and spacing. That process normalizes insignificant whitespace. Duplicate keys keep the last value the parser retained.
Validation
Validation is the parse step alone: either the text becomes a value, or the parser raises an error. A separate “validator” tool is useful when you want a clear pass/fail without rewriting the document.
How SmartKitio’s tools behave
- The JSON Formatter pretty-prints with two-space indentation or minifies to one line.
- Parse errors surface the browser’s JSON error message so you can locate the problem.
- Only strict JSON is accepted—not JSON5, not JSON Lines as a whole file.
- Parsing and formatting run locally in your browser; the payload is not uploaded to SmartKitio for processing.
- Integers beyond JavaScript’s safe integer range lose precision because they are read as IEEE-754 numbers—send large IDs as strings when that matters.
Common mistakes
Frequent JSON parse issues
| Symptom | Likely cause |
|---|---|
| Unexpected token ' | Single-quoted string or property |
| Unexpected token / | Comment (// or /* */) |
| Unexpected token } | Trailing comma before closing brace |
| Unexpected end of JSON | Truncated paste or incomplete bracket |
Try these SmartKitio tools
Use a tool when you want a result; keep this guide open when you want the method.
Browse family: Developer Tools
Related articles
Broader reading that connects to this guide—when the topic deserves more than a how-to.
- Client-Side vs Server-Side Processing
Where computation runs shapes privacy, latency, cost, and trust. A practical map of browser work versus server work—and what hybrid apps actually do.
- How to Read Technical Documentation Efficiently
Goal-first reading for API references, tutorials, auth, errors, and changelogs—with verification habits, sensible AI use, and tools when payloads get messy.
- JSON Explained: Why It Became So Popular
From Douglas Crockford’s minimal syntax to the default language of web APIs—how JSON won, what it forbids, and where it still hurts.
- What Is an API and How Does It Work?
APIs are contracts between programs. HTTP JSON APIs are the visible face—methods, headers, bodies, status codes, auth, and versioning explained.
Related guides
- JSON vs JSON5: What's the Difference?
Why JSON5 feels nicer to type, and why production APIs still standardize on strict JSON.
- Base64 Encoding Explained
How Base64 maps bytes to ASCII, why length grows, and how SmartKitio encodes UTF-8 text.
- Base64 Encoding vs Encryption
Why Base64 is reversible without a key, and what to use when you need confidentiality.
- URL Encoding Explained
Percent-encoding for query values, what encodeURIComponent changes, and common pitfalls.

