php-src/ext/json
Nikita Popov d372b33c9b Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Improve JSON error handling

Conflicts:
	ext/json/tests/bug54058.phpt
	ext/json/tests/bug61537.phpt
2012-06-27 12:28:55 +02:00
..
tests Merge branch 'PHP-5.3' into PHP-5.4 2012-06-27 12:28:55 +02:00
config.m4 The json header should be installed so other exts can use it 2009-06-23 13:09:34 +00:00
config.w32 - add PHP_INSTALL_HEADERS to all parts (core&exts) exposing headers, generate the install-headers cmd 2010-12-11 22:18:10 +00: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 Merge branch 'PHP-5.3' into PHP-5.4 2012-06-23 21:14:45 +02:00
json.c Merge branch 'PHP-5.3' into PHP-5.4 2012-06-27 12:28:55 +02:00
json.dsp revert change #298288: Remove old dsp/dsw/makefile files 2010-04-28 14:41:51 +00:00
package.xml
php_json.h Merge branch 'PHP-5.3' into PHP-5.4 2012-06-23 21:14:45 +02:00
README
utf8_decode.c MFH Fix bug #46944 - UTF-8 characters outside the BMP aren't encoded correctly. 2009-01-02 03:02:22 +00:00
utf8_decode.h
utf8_to_utf16.c Add unescaped Unicode encoding to json_encode(). Closes bug #53946. Patch by Irker and Gwynne. 2011-08-29 14:56:19 +00:00
utf8_to_utf16.h Add unescaped Unicode encoding to json_encode(). Closes bug #53946. Patch by Irker and Gwynne. 2011-08-29 14:56:19 +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/