Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^2: Converting boolean values in XMLout

by pKai (Priest)
on Jun 23, 2009 at 11:27 UTC ( #773972=note: print w/replies, xml ) Need Help??

in reply to Re: Converting boolean values in XMLout
in thread Converting boolean values in XMLout

You'll need to walk the structure

For which there is the fine Data::Rmap module:

use strict; use warnings; use JSON; use XML::Simple; use Data::Rmap qw(rmap_ref); use Data::Dumper; my $text = '{"a":"x","b":true}'; my $result = decode_json($text); print Dumper($result); rmap_ref { $_ = "$_" if JSON::is_bool($_) } $result; # or numify, like + ikegami shows above print Dumper($result); my $rec = XMLout( $result, RootName => 'root', SuppressEmpty => 1); print Dumper($rec);


$VAR1 = { 'a' => 'x', 'b' => bless( do{\(my $o = 1)}, 'JSON::XS::Boolean' ) }; $VAR1 = { 'a' => 'x', 'b' => 'true' }; $VAR1 = '<root a="x" b="true" /> ';

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://773972]
[beech]: checking chatterbox sidebar
[beech]: and again a check on chatterbox sidebar, what is expandability
beech me me me me me me testing chatterbox sidebar
beech my my /me me me me me me me chatterbox sidebar
beech testing chatterbox sidebar
[beech]: and something else

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2017-03-27 22:56 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (324 votes). Check out past polls.