in reply to Encountered object '5.03 ', but neither allow_blessed nor convert_blessed settings are enabled

I am not getting that error either, but are you sure that is your exact script - e.g. if you print the number before encoding it becomes a string. You can numify it by adding 0:
my $json = { 'book' => { 'title' => JSON::PP::true, 'pages' => 5.03 } }; print $json->{'book'}{'pages'}, "\n"; my $string = encode_json($json); print "After printing: $string\n"; $json->{'book'}{'pages'} += 0; my $string2 = encode_json($json); print "After numify: $string2\n";
Output:
5.03 After printing: {"book":{"title":true,"pages":"5.03"}} After numify: {"book":{"title":true,"pages":5.03}}
  • Comment on Re: Encountered object '5.03 ', but neither allow_blessed nor convert_blessed settings are enabled
  • Select or Download Code