Everyone uses JSON. Not everyone knows what actually happens under the hood when you call JSON.parse() or JSON.stringify().
What JSON is
JSON (JavaScript Object Notation) is a text-based format — not a binary format. That means when you "send JSON over an API", you're actually sending a plain string. The receiver parses that string back into a native data structure.
Serialization vs Parsing
| Operation | Direction | Function |
|---|---|---|
| Serialization | Object → String | JSON.stringify() |
| Parsing / Deserialization | String → Object | JSON.parse() |
What JSON supports
- Strings, numbers, booleans, null
- Arrays and nested objects
- Not supported: functions, undefined, Date objects, circular references
Why JSON beat XML
- No closing tags = smaller payloads
- Directly maps to native objects in most languages
- Human-readable without tooling
- Native browser support via
JSON.parse()
Cross-language compatibility
Every major language has native JSON support:
import json
data = json.loads('{"name": "Imad"}') # Python
const data = JSON.parse('{"name": "Imad"}') // JavaScript
echo '{"name": "Imad"}' | jq '.name' # Terminal
Further reading
Deep dive into JSON structure, parsing internals, and performance: How Does JSON Work — Complete Technical Guide
Need to work with JSON files? The JSON Merger and JSON Splitter tools handle the heavy lifting for free.
Top comments (0)