the output is {"5.0" : 5}. I need {"5.0" : "5.0" } I've spent a ton of time searching the documentation and experimenting without finding a solution. There is a blurb on stringifying a value by wrapping it in quotes or adding a trailing ."" but neither do the trick. It also strips leading zeros while maintaining the float value, 5.10 becomes 5.1my $json=JSON->new->allow_nonref; my $var='5.0'; print $json->encode( { $var => $var } );
In reply to Can I prevent JSON encode from converting values by somekindafreak
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |