Data is transferred between computers in various ways, whereby standardised data formats are required for comprehensible communication. This usually requires both parties to use the same medium (speech), the same format (language) and the same content (topics of conversation), just as between people. JSON fulfils the second objective, namely how the data is formatted. The abbreviation JSON stands for ‘JavaScript Object Notation’. This format is characterised as much leaner and more compact than XML, as it involves less overhead with tags.
As the name suggests, it is based on JavaScript object syntax, but is now independent of JavaScript and is supported in many programming languages. This means that structures of any complexity can be clearly displayed with curly brackets (for objects) and square brackets (for arrays).
For example:
{ "menu" : [{ "item_id" : 1, "dish" : "Fish-soup Macedonian-style" "price" : 12.00, "allergens" : [] }, { "item_id" : 2, "dish" : "Pad Thai" "price" : 23.50, "allergens" : [ "Nuts" , "Soya" ] } ] } |
Core features at a glance:
- JavaScript-compliant, can also be used independently
- Human-Readable
- Nestable
- Distinguishes between strings, numbers, Booleans (true/false), arrays (lists), objects (and null)
- Compact
- Does not prescribe a schema