« LiveUser and LiveUser Admin | Main | PDO intro on SitePoint »

PHP JSON

php-json is an extremely fast PHP C extension for JSON (JavaScript Object Notation) serialisation. php-json uses a forked version of json-c.

The extension allow to encode/decode variables between PHP and JSON. For example : $output = json_encode($val); echo $output."n"; Produce
{ "abc": 12, "foo": "bar", "bool0": false, "bool1": true, "arr": [ 1, 2, 3, null, 5 ], "float": 1.2345 }
While :
$input = '{ "abc": 12, "foo": "bar", "bool0": false, "bool1": true, "arr": [ 1, 2, 3, null, 5 ], "float": 1.2345 }'; $val = json_decode($input); echo $val->abc."n"; Will produce 12.

Bookmark this article at these sites
Post a comment





(Email will remain hidden)





Please enter the security code you see here




Related entries
Email to a friend
Email this article to:


Your email address:


Message (optional):