… | |
… | |
1006 | |
1006 | |
1007 | =over 4 |
1007 | =over 4 |
1008 | |
1008 | |
1009 | =item hash references |
1009 | =item hash references |
1010 | |
1010 | |
1011 | Perl hash references become JSON objects. As there is no inherent ordering |
1011 | Perl hash references become JSON objects. As there is no inherent |
1012 | in hash keys (or JSON objects), they will usually be encoded in a |
1012 | ordering in hash keys (or JSON objects), they will usually be encoded |
1013 | pseudo-random order that can change between runs of the same program but |
1013 | in a pseudo-random order. JSON::XS can optionally sort the hash keys |
1014 | stays generally the same within a single run of a program. JSON::XS can |
1014 | (determined by the I<canonical> flag), so the same datastructure will |
1015 | optionally sort the hash keys (determined by the I<canonical> flag), so |
1015 | serialise to the same JSON text (given same settings and version of |
1016 | the same datastructure will serialise to the same JSON text (given same |
1016 | JSON::XS), but this incurs a runtime overhead and is only rarely useful, |
1017 | settings and version of JSON::XS), but this incurs a runtime overhead |
1017 | e.g. when you want to compare some JSON text against another for equality. |
1018 | and is only rarely useful, e.g. when you want to compare some JSON text |
|
|
1019 | against another for equality. |
|
|
1020 | |
1018 | |
1021 | =item array references |
1019 | =item array references |
1022 | |
1020 | |
1023 | Perl array references become JSON arrays. |
1021 | Perl array references become JSON arrays. |
1024 | |
1022 | |