php-src/ext/json
Jakub Zelenka 3ddb5993dd Increase PHP_JSON_DOUBLE_MAX_LENGTH for fractional part
This is probably not necessary as such number
is not realistic. It's just to be consistent
with jsond extension.
2015-01-18 16:31:24 +00:00
..
tests Porting implementation of RFC json_preserve_fractional_part 2015-01-12 21:29:52 -05:00
config.m4 Merge branch 'master' into jsond 2014-12-27 19:42:04 +00:00
config.w32 Merge branch 'master' into jsond 2014-12-27 19:42:04 +00:00
CREDITS Initial import of jsond 2014-11-13 20:20:46 +00:00
json_encoder.c Increase PHP_JSON_DOUBLE_MAX_LENGTH for fractional part 2015-01-18 16:31:24 +00:00
json_parser.y Use ZVAL_COPY_VALUE for copying parser result to return_value 2015-01-01 19:19:31 +00:00
json_scanner.re Allow ill-formed unicode escapes in decoder 2015-01-04 17:34:49 +00:00
json.c Porting implementation of RFC json_preserve_fractional_part 2015-01-12 21:29:52 -05:00
Makefile.frag Fix compilation for json scanner 2014-11-30 18:29:48 +00:00
package.xml This commit was manufactured by cvs2svn to create branch 'PHP_5_2'. 2006-05-05 15:49:42 +00:00
php_json_encoder.h Merge branch 'master' into jsond 2014-12-27 19:42:04 +00:00
php_json_parser.h Merge branch 'master' into jsond 2014-12-27 19:42:04 +00:00
php_json_scanner.h Merge branch 'master' into jsond 2014-12-27 19:42:04 +00:00
php_json.h Porting implementation of RFC json_preserve_fractional_part 2015-01-12 21:29:52 -05: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/