DEV Community

Imad Uddin
Imad Uddin

Posted on

How JSON Actually Works -Parsing, Serialization & Data Exchange Explained

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
Enter fullscreen mode Exit fullscreen mode
const data = JSON.parse('{"name": "Imad"}')  // JavaScript
Enter fullscreen mode Exit fullscreen mode
echo '{"name": "Imad"}' | jq '.name'  # Terminal
Enter fullscreen mode Exit fullscreen mode

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)