Published on 2005-07-20 13:25:00

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.


Related Entries

Member of the PHP Magazine Network, Copyright (C) 2005-2009 phpmagazine.net All Rights Reserved