You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Kalle Sommer Nielsen 9e230424b5 Cast to unsigned char to prevent compiler warning 17 years ago
..
tests MFH Missing skip in tests 17 years ago
CREDITS Rebuild credits, was missed in previous RC 17 years ago
JSON_parser.c Cast to unsigned char to prevent compiler warning 17 years ago
JSON_parser.h MFH Allow a custom recursion depth to be specified for json_decode() 17 years ago
README This commit was manufactured by cvs2svn to create branch 'PHP_5_2'. 20 years ago
config.m4 MFH: Fix some configure --help texts 19 years ago
config.w32 MFH: enable by default 20 years ago
json.c MFH: Fix arginfo 17 years ago
json.dsp This commit was manufactured by cvs2svn to create branch 'PHP_5_2'. 20 years ago
package.xml This commit was manufactured by cvs2svn to create branch 'PHP_5_2'. 20 years ago
php_json.h MFH: Bump copyright year, 3 of 3. 17 years ago
utf8_decode.c MFH Fix bug #46944 - UTF-8 characters outside the BMP aren't encoded correctly. 17 years ago
utf8_decode.h This commit was manufactured by cvs2svn to create branch 'PHP_5_2'. 20 years ago
utf8_to_utf16.c MFH Fix bug #46944 - UTF-8 characters outside the BMP aren't encoded correctly. 17 years ago
utf8_to_utf16.h This commit was manufactured by cvs2svn to create branch 'PHP_5_2'. 20 years ago

README

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/