ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/README
(Generate patch)

Comparing JSON-XS/README (file contents):
Revision 1.16 by root, Thu Jul 26 11:33:35 2007 UTC vs.
Revision 1.18 by root, Tue Aug 28 02:06:06 2007 UTC

239 This setting has no effect when decoding JSON texts. 239 This setting has no effect when decoding JSON texts.
240 240
241 Example, space_before and indent disabled, space_after enabled: 241 Example, space_before and indent disabled, space_after enabled:
242 242
243 {"key": "value"} 243 {"key": "value"}
244
245 $json = $json->relaxed ([$enable])
246 If $enable is true (or missing), then "decode" will accept some
247 extensions to normal JSON syntax (see below). "encode" will not be
248 affected in anyway. *Be aware that this option makes you accept
249 invalid JSON texts as if they were valid!*. I suggest only to use
250 this option to parse application-specific files written by humans
251 (configuration files, resource files etc.)
252
253 If $enable is false (the default), then "decode" will only accept
254 valid JSON texts.
255
256 Currently accepted extensions are:
257
258 * list items can have an end-comma
259 JSON *separates* array elements and key-value pairs with commas.
260 This can be annoying if you write JSON texts manually and want
261 to be able to quickly append elements, so this extension accepts
262 comma at the end of such items not just between them:
263
264 [
265 1,
266 2, <- this comma not normally allowed
267 ]
268 {
269 "k1": "v1",
270 "k2": "v2", <- this comma not normally allowed
271 }
272
273 * shell-style '#'-comments
274 Whenever JSON allows whitespace, shell-style comments are
275 additionally allowed. They are terminated by the first
276 carriage-return or line-feed character, after which more
277 white-space and comments are allowed.
278
279 [
280 1, # this comment not allowed in JSON
281 # neither this one...
282 ]
244 283
245 $json = $json->canonical ([$enable]) 284 $json = $json->canonical ([$enable])
246 If $enable is true (or missing), then the "encode" method will 285 If $enable is true (or missing), then the "encode" method will
247 output JSON objects by sorting their keys. This is adding a 286 output JSON objects by sorting their keys. This is adding a
248 comparatively high overhead. 287 comparatively high overhead.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines