… | |
… | |
78 | =cut |
78 | =cut |
79 | |
79 | |
80 | package JSON::XS; |
80 | package JSON::XS; |
81 | |
81 | |
82 | BEGIN { |
82 | BEGIN { |
83 | $VERSION = '0.3'; |
83 | $VERSION = '0.31'; |
84 | @ISA = qw(Exporter); |
84 | @ISA = qw(Exporter); |
85 | |
85 | |
86 | @EXPORT = qw(to_json from_json); |
86 | @EXPORT = qw(to_json from_json); |
87 | require Exporter; |
87 | require Exporter; |
88 | |
88 | |
… | |
… | |
312 | =over 4 |
312 | =over 4 |
313 | |
313 | |
314 | =item object |
314 | =item object |
315 | |
315 | |
316 | A JSON object becomes a reference to a hash in Perl. No ordering of object |
316 | A JSON object becomes a reference to a hash in Perl. No ordering of object |
317 | keys is preserved. |
317 | keys is preserved (JSON does not preserver object key ordering itself). |
318 | |
318 | |
319 | =item array |
319 | =item array |
320 | |
320 | |
321 | A JSON array becomes a reference to an array in Perl. |
321 | A JSON array becomes a reference to an array in Perl. |
322 | |
322 | |
… | |
… | |
358 | =item hash references |
358 | =item hash references |
359 | |
359 | |
360 | Perl hash references become JSON objects. As there is no inherent ordering |
360 | Perl hash references become JSON objects. As there is no inherent ordering |
361 | in hash keys, they will usually be encoded in a pseudo-random order that |
361 | in hash keys, they will usually be encoded in a pseudo-random order that |
362 | can change between runs of the same program but stays generally the same |
362 | can change between runs of the same program but stays generally the same |
363 | within the single run of a program. JSON::XS can optionally sort the hash |
363 | within a single run of a program. JSON::XS can optionally sort the hash |
364 | keys (determined by the I<canonical> flag), so the same datastructure |
364 | keys (determined by the I<canonical> flag), so the same datastructure |
365 | will serialise to the same JSON text (given same settings and version of |
365 | will serialise to the same JSON text (given same settings and version of |
366 | JSON::XS), but this incurs a runtime overhead. |
366 | JSON::XS), but this incurs a runtime overhead. |
367 | |
367 | |
368 | =item array references |
368 | =item array references |