PageRenderTime 167ms CodeModel.GetById 162ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1#!/usr/bin/env perl
 2
 3# demo script to load a JSON data structure
 4use strict;
 5use warnings;
 6use JSON;
 7use Data::Dumper;
 8
 9my $parser = JSON->new->ascii->pretty->allow_nonref;
10
11my $json_string;
12
13while ( <STDIN> ) {
14    # add the line to the JSON string
15    $json_string .= $_;
16} # while ( <STDIN> )
17
18my $object = $parser->decode($json_string);
19my $dumper = Data::Dumper->new([$object]);
20print $dumper->Dump . qq(\n);