in reply to Re: JSON module & decoding boolean data
in thread JSON module & decoding boolean data

Actually I don't care for an object there at all. According to the module POD, upon decode true should become 1 & false should be represented as 0, which is what I'm looking for. So I guess what I want is instead of JSON::false, can I get 0 back upon decode.
  • Comment on Re^2: JSON module & decoding boolean data

Replies are listed 'Best First'.
Re^3: JSON module & decoding boolean data
by samarzone (Pilgrim) on Apr 22, 2010 at 07:54 UTC
    If you use these values (e.g. in print, if or mathematical calculation), these will work as 0 or 1

    UPDATE:

    # perl -MJSON::XS -e '$x = q/{"bool":true}/;$y=decode_json($x);print " +$y->{bool}\n"' 1

      Thanks, that is all I was looking for.