JavaScript Object Notation (JSON)

JSON, or JavaScript Object Notation, is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition - December 1999.

<?php

    $array = ['a' => 1, 'b' => "c", 'c' => [3, 4], 'd' => new stdclass()];

    echo json_encode($arr);
    // displays {\a\:1,\b\:\c\,\c\:[3,4],\d\:{}}

?>

Documentation

See also JSON home, Working with JSON data in PHP and MySQL: storing and retrieving complex structures and An In-depth Comparison of JSON, YAML, and TOML.

Related : Comma Secparated Values (CSV), json_decode(), JsonSerializable, Serde, JSON Lines (JSONC), JSON Lines (JSONL), YAML Ain’t Markup Language (YAML), Tom’s Obvious Minimal Language (TOML), Text, Format, json_encode(), JsonException, Parquet, INI, PostgreSQL, Progressive Web App, Schema, AJAX, Document Database, JSON Web Token (JWT), Template, Multidimensional Array

Related packages : jajo/jsondb

Added in PHP 5.0+