php-src/ext/json
2016-08-14 13:52:59 +01:00
..
tests Fixed bug #72787 (json_decode reads out of bounds) 2016-08-14 13:52:59 +01:00
config.m4 Remove unused code from ext/json. 2014-03-30 18:06:39 +02:00
config.w32 Remove unused code from ext/json. 2014-03-30 18:06:39 +02:00
CREDITS Rebuild credits, was missed in previous RC 2009-04-02 09:18:00 +00:00
JSON_parser.c Fix Bug #53963, error code isn't always set in certain error cases. 2011-02-09 08:05:00 +00:00
JSON_parser.h Revert JSON merges to 5.4 2012-07-01 16:38:26 +02:00
json.c Fixed bug #72787 (json_decode reads out of bounds) 2016-08-14 13:52:59 +01:00
json.dsp Merge remote-tracking branch 'github/pr/637' into PHP-5.6 2015-04-18 17:56:33 -07:00
package.xml Merge remote-tracking branch 'github/pr/637' into PHP-5.6 2015-04-18 17:56:33 -07:00
php_json.h Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
README This commit was manufactured by cvs2svn to create branch 'PHP_5_2'. 2006-05-05 15:49:42 +00:00

json 1.2.0
==========

This extension implements the JavaScript Object Notation (JSON)
data-interchange format as specified in [0].

Two functions are implemented: encoding and decoding. The decoding
is handled by a parser based on JSON_checker[1] by Douglas Crockford.


Function overview
-----------------

    string json_encode ( mixed value )

json_encode returns a string containing the JSON representation of value.
value can be any type except a resource.

    mixed json_decode ( string json, [bool assoc] )

json_decode takes a JSON string and converts it into a PHP variable.
When assoc is given, and evaluates to TRUE, json_decode() will return
any objects as associative arrays.


Example usage
-------------

$arr = array("a"=>1,"b"=>2,"c"=>3,"d"=>4,"e"=>5);
echo json_encode($arr);

---> {"a":1,"b":2,"c":3,"d":4,"e":5}

$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json));

---> object(stdClass)#1 (5) {
        ["a"]=>
        int(1)
        ["b"]=>
        int(2)
        ["c"]=>
        int(3)
        ["d"]=>
        int(4)
        ["e"]=>
        int(5)
     }

$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json, true));

---> array(5) {
        ["a"]=>
        int(1)
        ["b"]=>
        int(2)
        ["c"]=>
        int(3)
        ["d"]=>
        int(4)
        ["e"]=>
        int(5)
     }


Authors
-------

Omar Kilani <omar@php.net>


---

[0] http://www.crockford.com/JSON/draft-jsonorg-json-00.txt
[1] http://www.crockford.com/JSON/JSON_checker/