/scripts/tests/json_load.pl
https://code.google.com/p/camelbox/ · Perl · 20 lines · 12 code · 5 blank · 3 comment · 1 complexity · e39cde85bfd5746f5c174bf04ef5920b MD5 · raw file
- #!/usr/bin/env perl
- # demo script to load a JSON data structure
- use strict;
- use warnings;
- use JSON;
- use Data::Dumper;
- my $parser = JSON->new->ascii->pretty->allow_nonref;
- my $json_string;
- while ( <STDIN> ) {
- # add the line to the JSON string
- $json_string .= $_;
- } # while ( <STDIN> )
- my $object = $parser->decode($json_string);
- my $dumper = Data::Dumper->new([$object]);
- print $dumper->Dump . qq(\n);