Glossary

JSON

JSON (JavaScript Object Notation) is a text-based data interchange format and a subset of JavaScript. Human-readable, compact, supported by every programming language. The de facto standard for REST APIs and configuration files.

Data types

{
  "string": "hello",
  "number": 42,
  "float": 3.14,
  "boolean": true,
  "null": null,
  "array": [1, 2, 3],
  "object": { "key": "value" }
}

PHP

$json = json_encode($data);       // array → string
$data = json_decode($json, true); // string → array
// Check for errors:
if (json_last_error() !== JSON_ERROR_NONE) { ... }

JSON vs XML

JSON: shorter, simpler to read and parse. XML: supports attributes, namespaces, schemas (XSD), better suited to complex documents. On the web, JSON has won.

JSON Schema

A specification for describing and validating the structure of a JSON document. The equivalent of XSD for XML.