JSON vs XML
Both hold data as plain text. JSON uses names and curly brackets; XML wraps each value in tags, which makes it longer.
JavaScript Object Notation (JSON)
A plain text format for data, made of names and values. Most APIs use it.
JSON is a plain text way to write down data so programs can swap it. It uses names and values in curly brackets, like "age": 36. It can hold text, numbers, true or false, null, lists and nested groups. Almost every language can read and write it. Most web APIs send and receive their data as JSON.
Extensible Markup Language (XML)
A text format that wraps data in named tags. Wordy, but still common in older systems.
XML is a text format that wraps each piece of data in named tags. A tag looks like <name>Emma</name>, and tags can sit inside other tags. It is wordier than JSON, because every tag is written twice. It is still used in office files, RSS feeds, Android layouts and many older business systems. HTML looks similar, but HTML is for pages and XML is for data.
In one line
- JavaScript Object Notation (JSON)
- A plain text format for data, made of names and values. Most APIs use it.
- Extensible Markup Language (XML)
- A text format that wraps data in named tags. Wordy, but still common in older systems.