nleaman has asked for the wisdom of the Perl Monks concerning the following question:
OUTPUT:#!/usr/bin/perl -w use strict; use Data::Dumper; use JSON; # sample json data my $json_text = <<END; { "id": 559, "bool_one": false, "bool_two": false, "bool_three": false, "alertStates": ["OK"] } END my $json_text_decoded = decode_json $json_text; print Dumper $json_text_decoded ; print "\n$json_text_decoded\n"; foreach (keys %{($json_text_decoded)}) { print " $_ = $$json_text_decoded{$_}\n"; }
$VAR1 = { 'alertStates' => [ 'OK' ], 'bool_two' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ) +, 'bool_three' => $VAR1->{'bool_two'}, 'bool_one' => $VAR1->{'bool_two'}, 'id' => 559 }; HASH(0x100873888) alertStates = ARRAY(0x1008739c0) bool_two = false bool_three = false bool_one = false id = 559
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why is Dumper showing decoded JSON booleans like this?
by ikegami (Patriarch) on Mar 03, 2010 at 18:08 UTC | |
by nleaman (Initiate) on Mar 03, 2010 at 19:42 UTC | |
by ikegami (Patriarch) on Mar 03, 2010 at 20:18 UTC | |
by nleaman (Initiate) on Mar 04, 2010 at 21:01 UTC | |
|
Re: Why is Dumper showing decoded JSON booleans like this?
by Anonymous Monk on Mar 03, 2010 at 18:11 UTC |