JSON (JavaScript Object Notation) is a lightweight data exchange format widely used in APIs, storage, and communication between systems. Its simplicity makes it very powerful, but it’s essential to know the types of data it supports to avoid errors.
JSON defines six main data types:
Represents text and should always be between double quotes.
{ "name": "Isma" }
Important notes:
Includes both integers and decimals. JSON does not distinguish between numeric types (int, float, etc.).
{ "age": 30, "height": 1.75 }
Important Notes:
Only accepts two values: true and false.
{ "active": true }
Important Notes:
Represents an empty value or absence of a value.
{ "direccion": null }
5. Array (array or list)
An ordered list of values, which can be of any valid JSON type.
{ "hobbies": ["programar", "leer", "gym"] }
It can also contain objects:
html
{ "users": [ { "name": "Ana" }, { "name": "Luis" } ] }
6. Object (object)
Key-Value pair structure. It is the most commonly used in JSON.
{ "user": { "name": "Isma", "age": 30 } }
Important Notes:
{ "name": "Isma", "age": 30, "active": true, "address": null, "hobbies": ["program", "read"], "profile": { "role": "developer", "experience": 5 } }
Common Errors in JSON
These are some of the most common mistakes:
Error: Incorrect example
{ "nombre": 'Isma', // incorrect "activo": True, // incorrect }
Differences from other languages
Although JSON appears to be JavaScript or Python, it has stricter rules:
JSON is a simple yet very structured format. Mastering its data types is key to working correctly with APIs, databases, and artificial intelligence systems.
The six fundamental types are:
You can represent any standard and system-compatible data structure practically with this.
