Cookies for analytics and advertising
We use cookies for analytics and advertising, both sent to Google. Refusing changes nothing you can see.Read the privacy page
JSON for interfaces between programs, XML where a schema has to be enforced.
Choose JSON when
Web APIs and configuration. Less punctuation, native in every browser, and it maps directly onto the data structures programs already use.
Choose XML when
Documents and regulated exchange, where namespaces, attributes and a validating schema are the point rather than overhead.
The two are not interchangeable. XML distinguishes attributes from elements and JSON has no such thing, so a round trip through JSON quietly flattens that distinction.
| JSON | XML | |
|---|---|---|
| Full name | JavaScript Object Notation | Extensible Markup Language |
| Extension | .json | .xml |
| Media type | application/json | application/xml |
| Compression | Uncompressed | Uncompressed |
| This site can write it | Yes | Yes |