Comment

Comment by WesolyKubeczek

The darling JSON::XS is doing it.

    perl -MJSON::XS=encode_json -MData::Dumper -E 'my $d = { foo => 42 }; say encode_json($d); say "foo is $d->{foo}"; say encode_json($d);'
Output:

    {"foo":42}
    foo is 42
    {"foo":"42"}
JSON::PP and Cpanel::JSON::XS don't have this bug, but JSON::XS is quite entrenched in some codebases.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton