in reply to Non JSON.pm solution for JSON
Try Mojo::JSON.
Update: dammit - that uses B. You could quite easily strip out the B parts though - it's only used to differentiate between numbers and strings. If you're happy with a sloppy conversion, you could just detect which scalars "look like numbers" using a regular expression instead of B.
To see what I mean, on a Perl box with JSON.pm installed, try:
perl -MJSON -e'print to_json {number=>1, string=>"1"}, {pretty=>1, can +onical=>1}'
|
|---|