Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6157515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:47:55+00:00 2026-05-23T20:47:55+00:00

Decoded JSON booleans are objects: #!/usr/bin/env perl use strict; use warnings; use Data::Dumper; use

  • 0

Decoded JSON booleans are objects:

#!/usr/bin/env perl

use strict;
use warnings;

use Data::Dumper;
use JSON;

my $json_string = '{"boolean_field":true}';
my $decoded_json = from_json $json_string;

print Dumper $decoded_json;

Output:

$VAR1 = {
          'boolean_field' => bless( do{\(my $o = 1)}, 'JSON::XS::Boolean' )
        };

From the JSON.pm documentation I know about the following three methods:

  • JSON::is_bool
  • JSON::true
  • JSON::false

However, for some silly reason I don’t know how to determine if the value of ‘boolean_field’ in $decoded_json is true or false.

(Sorry for the very basic question; it’s been driving me batty!)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:47:56+00:00Added an answer on May 23, 2026 at 8:47 pm

    It will be a truthy value in Perl. Just access it as normal.

    print 'true' if $decoded_json->{'boolean_field'};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm trying to use json_decode to combine a few json objects and then re-encode
I'm having an issue comparing objects encoded and decoded to and from JSON //Test
I'm trying handle bad json data when parsed through json_decode(). I'm using the following
using the below code for decoding json $categories = json_decode($data); $categories = $categories->data; where
I have the following already decoded json stored in $response = $result->response; : object(stdClass)#6
I'm trying to get some info out of a decoded JSon string into an
I have a Json data retrieved from facebook using graph api, now i am
I have some json object that I decoded, and one of the attributes starts
I need to use a GET request to send JSON to my server via
Hi I am using simplejson to import some json and then decode for use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.