php-src/ext/json
2009-05-19 16:06:17 +00:00
..
tests Missing skip in tests 2009-03-17 23:29:39 +00:00
config.m4 - Fix some configure --help texts 2007-07-03 17:24:39 +00:00
config.w32 enable by default 2006-07-22 15:32:17 +00:00
CREDITS MFB Rebuild credits, was missed in previous RC 2009-04-02 09:24:16 +00:00
JSON_parser.c MFB: Cast to unsigned char to prevent compiler warning 2009-05-19 16:06:17 +00:00
JSON_parser.h Allow the json_decode() depth to be any size, but keep the static one around for now. It might make sense to allow an unbound depth. 2009-05-14 00:13:57 +00:00
json.c Fix arginfo 2009-05-15 09:10:01 +00:00
json.dsp - Rewritten for better performance. 3-8x faster encodes, 2-4x faster decodes. 2006-01-31 08:59:06 +00:00
package.xml Fix PECL bug #7147 - rework comma insertion whilst encoding. 2006-03-18 04:15:16 +00:00
php_json.h - This is PHP 6 - if this ... ever gets out 2009-03-10 23:40:06 +00:00
README Add some documentation to the JSON extension. 2006-01-31 09:00:47 +00:00
utf8_decode.c Fix bug #46944 - UTF-8 characters outside the BMP aren't encoded correctly. 2009-01-02 03:01:53 +00:00
utf8_decode.h - Rewritten for better performance. 3-8x faster encodes, 2-4x faster decodes. 2006-01-31 08:59:06 +00:00
utf8_to_utf16.c Fix bug #46944 - UTF-8 characters outside the BMP aren't encoded correctly. 2009-01-02 03:01:53 +00:00
utf8_to_utf16.h - Rewritten for better performance. 3-8x faster encodes, 2-4x faster decodes. 2006-01-31 08:59:06 +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/