diamondsandperls has asked for the wisdom of the Perl Monks concerning the following question:
$VAR1 = '{ "alertCounts" : [ { "count" : 5, "rule" : "rule1" }, { "count" : 16, "rule" : "rule2" } ], "balArray" : [ { "containerArray" : [], "name" : "user_ip" }, { "containerArray" : [ { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 56, "name" : "/my/page", "priority" : 4, "rule" : "rule1", "timestamp" : "15:28:40.150" } ], "name" : "192.168.1.100" }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 185, "name" : "/my/page", "priority" : 4, "rule" : "rule2", "timestamp" : "15:12:55.961" } ], "name" : "192.168.1.101" } ' ;
#JSON my $json = new JSON; my $json_text = $json->decode($content); foreach my $json_data(@{$json_text->{balArray}[0]{containerArray}[0]{e +ntryArray}[0]}) { print {$output_fh} "$json_data->{timestamp},"; print {$output_fh} "$json_data->{flag},\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: JSON parsing issue please help
by BrowserUk (Patriarch) on Sep 29, 2012 at 18:14 UTC | |
by Anonymous Monk on Sep 30, 2012 at 06:20 UTC | |
by BrowserUk (Patriarch) on Sep 30, 2012 at 07:01 UTC | |
|
Re: JSON parsing issue please help
by davido (Cardinal) on Sep 29, 2012 at 18:45 UTC | |
by diamondsandperls (Beadle) on Sep 29, 2012 at 19:36 UTC | |
by davido (Cardinal) on Sep 29, 2012 at 19:53 UTC | |
by diamondsandperls (Beadle) on Sep 29, 2012 at 20:51 UTC | |
by james2vegas (Chaplain) on Oct 01, 2012 at 10:00 UTC | |
by Anonymous Monk on Sep 30, 2012 at 06:26 UTC | |
by Anonymous Monk on Sep 30, 2012 at 06:24 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |