What is JSON? Complete Technical Guide – DataMorph
Learn about JavaScript Object Notation (JSON), its syntax rules, data types, and how it compares to XML and YAML.
What is JSON? Complete Technical Guide
JavaScript Object Notation (JSON) is a lightweight, text-based, language-independent data interchange format. Derived from the object literal syntax of JavaScript, JSON is widely used for sending data in REST APIs, configuration files, and mobile-to-backend applications. Its simple structure makes it easy for humans to read and write, and highly efficient for machines to parse and generate.
JSON Syntax Rules and Data Types
A valid JSON document must conform to strict structural rules. Objects are enclosed in curly braces {} and represent key-value pairs. Arrays are enclosed in square brackets [] and contain lists of values. JSON values must be one of the following six primitive data types:
- String: Double-quoted Unicode characters (e.g.,
"name"). - Number: Double-precision floating-point numbers (e.g.,
42,3.14). - Boolean: Literal values
trueorfalse. - Null: The literal empty value
null. - Object: A collection of key-value pairs.
- Array: An ordered list of values.
JSON vs XML vs YAML Comparison
While JSON is the industry standard for APIs, XML (Extensible Markup Language) is often used in legacy enterprise configurations, and YAML (YAML Ain't Markup Language) is preferred for human-readable DevOps/Kubernetes setups. JSON strikes a balance between readability and machine-parsability, whereas XML is verbose and YAML has complex indentation rules. For format conversions, you can use our JSON to YAML Converter or our XML to JSON Converter on DataMorph.