diamondsandperls has asked for the wisdom of the Perl Monks concerning the following question:
I am not even close on this one I have parsed only easier JSON data in the past this one has a lot more going on it seems.
Thank you to all who reply
JSON SAMPLE:
Thank you to all who reply
JSON SAMPLE:
SAMPLE CODE:"balArray" : [ { "containerArray" : [], "name" : "user_ip" }, { "containerArray" : [ { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 128, "name" : "/my/page", "priority" : 4, "rule" : "my_rule", "timestamp" : "21:16:46.946" } ], "name" : "192.168.1.100" }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 113, "name" : "/my/page2", "priority" : 4, "rule" : "my_rule2", "timestamp" : "21:18:57.750" } ], "name" : "192.168.1.101" },
#JSON my $json = new JSON; my $json_text = $json->decode($content); foreach my $json_data(@{$json_text->{entryArray}}) { print {$output_fh} " $json_data->{timestamp},"; print {$output_fh} " $json_data->{name},"; print {$output_fh} "$json_data->{rule},"; print {$output_fh} "$json_data->{priority},\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: problem parsing json
by davido (Cardinal) on Sep 28, 2012 at 23:53 UTC | |
by diamondsandperls (Beadle) on Sep 29, 2012 at 00:28 UTC | |
Re: problem parsing json
by Anonymous Monk on Sep 29, 2012 at 01:15 UTC | |
by diamondsandperls (Beadle) on Sep 29, 2012 at 02:55 UTC | |
by davido (Cardinal) on Sep 29, 2012 at 05:37 UTC | |
by Anonymous Monk on Sep 29, 2012 at 06:26 UTC | |
by diamondsandperls (Beadle) on Sep 29, 2012 at 12:12 UTC | |
by diamondsandperls (Beadle) on Sep 29, 2012 at 04:49 UTC |
Back to
Seekers of Perl Wisdom