.json
extension.
{}
, containing key-value pairs. Example: {"name": "Raj", "age": 30}
[]
, containing a list of values. Example: ["apple", "banana", "cherry"]
:
and a value. Example: "name": "Raj"
true
, false
, or null
. Example: {"isStudent": false, "grades": [90, 85, 88]}
Feature | JSON | XML | YAML |
---|---|---|---|
Readability | High | Moderate | High |
Verbosity | Low | High | Low |
Data Types | Basic (no dates, binary) | Supports complex types | Supports complex types |
Schema Support | No (requires external tools) | Yes (XSD) | No |
Use Case | Web APIs, configuration | Document markup, legacy APIs | Configuration, data serialization |
{}
, arrays []
, key-value pairs "key": value
.