|
1 |
| -json 1.2.0 |
| 1 | +JSON |
2 | 2 | ==========
|
3 | 3 |
|
4 |
| -This extension implements the JavaScript Object Notation (JSON) |
5 |
| -data-interchange format as specified in [0]. |
6 |
| - |
7 |
| -Two functions are implemented: encoding and decoding. The decoding |
8 |
| -is handled by a parser based on JSON_checker[1] by Douglas Crockford. |
9 |
| - |
10 |
| - |
11 |
| -Function overview |
12 |
| ------------------ |
13 |
| - |
14 |
| - string json_encode ( mixed value ) |
15 |
| - |
16 |
| -json_encode returns a string containing the JSON representation of value. |
17 |
| -value can be any type except a resource. |
18 |
| - |
19 |
| - mixed json_decode ( string json, [bool assoc] ) |
20 |
| - |
21 |
| -json_decode takes a JSON string and converts it into a PHP variable. |
22 |
| -When assoc is given, and evaluates to TRUE, json_decode() will return |
23 |
| -any objects as associative arrays. |
24 |
| - |
25 |
| - |
26 |
| -Example usage |
27 |
| -------------- |
28 | 4 |
|
29 |
| -$arr = array("a"=>1,"b"=>2,"c"=>3,"d"=>4,"e"=>5); |
30 |
| -echo json_encode($arr); |
31 |
| - |
32 |
| ----> {"a":1,"b":2,"c":3,"d":4,"e":5} |
33 |
| - |
34 |
| -$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}'; |
35 |
| -var_dump(json_decode($json)); |
36 |
| - |
37 |
| ----> object(stdClass)#1 (5) { |
38 |
| - ["a"]=> |
39 |
| - int(1) |
40 |
| - ["b"]=> |
41 |
| - int(2) |
42 |
| - ["c"]=> |
43 |
| - int(3) |
44 |
| - ["d"]=> |
45 |
| - int(4) |
46 |
| - ["e"]=> |
47 |
| - int(5) |
48 |
| - } |
49 |
| - |
50 |
| -$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}'; |
51 |
| -var_dump(json_decode($json, true)); |
52 |
| - |
53 |
| ----> array(5) { |
54 |
| - ["a"]=> |
55 |
| - int(1) |
56 |
| - ["b"]=> |
57 |
| - int(2) |
58 |
| - ["c"]=> |
59 |
| - int(3) |
60 |
| - ["d"]=> |
61 |
| - int(4) |
62 |
| - ["e"]=> |
63 |
| - int(5) |
64 |
| - } |
65 |
| - |
66 |
| - |
67 |
| -Authors |
68 |
| -------- |
69 |
| - |
70 |
| -Omar Kilani <omar@php.net> |
| 5 | +This extension implements the JavaScript Object Notation (JSON) |
| 6 | +data-interchange format as specified in RFC 7159 |
71 | 7 |
|
| 8 | +The parser is implemented using re2c and Bison. The used versions |
| 9 | +of both tools for generating files in the repository are following: |
72 | 10 |
|
73 |
| ---- |
| 11 | +re2c 0.13.7.5 |
| 12 | +Bison 3.0.4 |
74 | 13 |
|
75 |
| -[0] http://www.crockford.com/JSON/draft-jsonorg-json-00.txt |
76 |
| -[1] http://www.crockford.com/JSON/JSON_checker/ |
| 14 | +It is recommended to do all contributions to the JSON extension |
| 15 | +through the Github Pull Requests and preferably ping @bukka |
| 16 | +who maintains the extension. |
0 commit comments