equal
deleted
inserted
replaced
92 define('SERVICES_JSON_SUPPRESS_ERRORS', 32); |
92 define('SERVICES_JSON_SUPPRESS_ERRORS', 32); |
93 |
93 |
94 /** |
94 /** |
95 * Converts to and from JSON format. |
95 * Converts to and from JSON format. |
96 * |
96 * |
97 * Brief example of use: |
97 * @example <code> |
98 * |
|
99 * <code> |
|
100 // create a new instance of Services_JSON |
98 // create a new instance of Services_JSON |
101 $json = new Services_JSON(); |
99 $json = new Services_JSON(); |
102 |
100 |
103 // convert a complexe value to JSON notation, and send it to the browser |
101 // convert a complexe value to JSON notation, and send it to the browser |
104 $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); |
102 $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); |
109 |
107 |
110 // accept incoming POST data, assumed to be in JSON notation |
108 // accept incoming POST data, assumed to be in JSON notation |
111 $input = file_get_contents('php://input', 1000000); |
109 $input = file_get_contents('php://input', 1000000); |
112 $value = $json->decode($input); |
110 $value = $json->decode($input); |
113 </code> |
111 </code> |
|
112 * |
114 */ |
113 */ |
115 class Services_JSON |
114 class Services_JSON |
116 { |
115 { |
117 /** |
116 /** |
118 * constructs a new JSON instance |
117 * constructs a new JSON instance |