Subject: | incorrect serialisation of numeric arrays |
JSON->new->encode a Perl array of numbers and then JSON->new->decode it will return the first element of the array as a string, while the rest of the array correctly stays as numbers.
[1,2,3] becomes ["1",2,3]
Obviously this breaks round trip serialisation/deserialisation.
I suspect that this may be due to JSON triggering an implicit type conversion when peeking at the first value in the array - perhaps in a string comparison operator (e.g. eq), which will quietly change the type from numeric to string.
----------
Perl 5, version 12, subversion 4 (v5.12.4) built for darwin-thread-multi-2level
Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64