in reply to Re^2: How do I make the JSON module convert true/false to 1/0 instead of a blessed Boolean object?
in thread How do I make the JSON module convert true/false to 1/0 instead of a blessed Boolean object?

Hello Cody Fendant

grepping CPAN it seems the method ships with JSON::PP and you can read about it

# Note that JSON version 2.0 and above will automatically use # JSON::XS or JSON::PP, so you should be able to just: use JSON;

This probably means you have also JSON::XS installed and it is loaded first

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
  • Comment on Re^3: How do I make the JSON module convert true/false to 1/0 instead of a blessed Boolean object?
  • Download Code

Replies are listed 'Best First'.
Re^4: How do I make the JSON module convert true/false to 1/0 instead of a blessed Boolean object?
by ikegami (Patriarch) on Jan 03, 2022 at 14:24 UTC

    Both JSON::PP and JSON::XS support boolean_values, and the error message said the method wasn't found in JSON, not JSON::XS.

      Well my question is about JSON, but if the answer is to use one of the other modules specifically then I guess that works.

      I would still say the documentation could be improved though.

        That's not what I was suggesting. JSON.pm isn't a JSON parser. It's merely a front end for JSON::PP and JSON::XS. The post to which I was replying suggested that boolean_values works when JSON.pm acts as a front end for JSON::PP, but doesn't work when it acts as a front-end for JSON::XS. I was stating that this is incorrect. It works for both back ends.