Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

JSON parsing issue please help

by diamondsandperls (Beadle)
on Sep 29, 2012 at 17:56 UTC ( #996409=perlquestion: print w/ replies, xml ) Need Help??
diamondsandperls has asked for the wisdom of the Perl Monks concerning the following question:

The below json call is really what i am trying to parse.
$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" } ' ;


SAMPLE CODE:
#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"; }

Comment on JSON parsing issue please help
Select or Download Code
Re: JSON parsing issue please help
by BrowserUk (Pope) on Sep 29, 2012 at 18:14 UTC

    It is usual to state what problem you are having, or how the results of your code differ from your expectations.

    However, looking at your code, I see you are trying to iterate the array held in the first element of the entryArray array:

    @{ $json_text->{balArray}[0]{containerArray}[0]{entryArray}[0] } ...........................................................^^^

    But looking at the json, the elements of the entryArray array, do not contain arrays, they contain hashes.

    If you were using strict and warnings, you'd be getting a "Not an ARRAY reference at .." message pointing at the above line, which would be a strong clue to the solution of your problem.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

    /font

      If you were using strict and warnings, you'd be getting a "Not an ARRAY reference at .." message pointing at the above line, which would be a strong clue to the solution of your problem.

      neither strict nor warnings are required

      $ perl -e " $f = { }; $f->[0]; " Not an ARRAY reference at -e line 1.

        Good point.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

        RIP Neil Armstrong

Re: JSON parsing issue please help
by davido (Archbishop) on Sep 29, 2012 at 18:45 UTC

    Your use of Data::Dumper to dump the data you're working with is helpful to us. It proves once and for all that the data you're dealing with isn't valid JSON.

    use strict; use warnings; use Data::Dumper; use File::Slurp; use JSON::Tiny; use feature qw/say/; my $json = read_file(\*DATA); my $j = JSON::Tiny->new; my $decoded = $j->decode($json); if( defined $decoded ) { say Dumper $decoded; } else { say $j->error; } __DATA__ { "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" }

    ...and the output...

    Malformed JSON: Expected comma or right square bracket while parsing a +rray before end of data

    Or once again, since you're using JSON:

    , or ] expected while parsing array, at character offset 1004 (before +"(end of string)") at ./mytest.pl line 13.

    If you have valid JSON, post your valid JSON. If you have invalid JSON, don't expect code that parses JSON to work.


    Dave

      I change the code some see below.

      #JSON my $json = new JSON; my %json_text = %{ $json->decode($content) }; while (my ($key, $value) = each %json_text) { print "$key = $value\n"; } close $output_fh;


      OUTPUT I AM GETTING:

      alertCounts = ARRAY(0x32dadd4)
      balArray = ARRAY(0x34a7e94)

        No, you're not getting the output you show using the JSON you posted. Look at the #@%!^ JSON you posted. It is not capable of resulting in the output you are showing. Here's what I get when I test it:

        use strict; use warnings; use File::Slurp; use JSON; my $json = read_file(\*DATA); my $j = JSON->new; my %json_text = %{ $j->decode($json) }; while( my ( $key, $value ) = each %json_text ) { print "$key = $value\n"; } __DATA__ { "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" }

        And the output:

        , or ] expected while parsing array, at character offset 1206 (before +"(end of string)") at ./mytest.pl line 12.

        I don't know how many more times you need someone to tell you that the sample input you're posting isn't capable of producing any reasonable output because it's broken. Post real JSON that isn't malformed, and we can begin to talk about your code.


        Dave

JSON Parsing issue still !!
by diamondsandperls (Beadle) on Sep 30, 2012 at 17:35 UTC
    Ok this time this is the entire JSON call. I have tried different methods of parsing even as a hash as recommended by a previous post it took forever to edit this file to where i could post it, but I have spent so long on this issue already. The output was created with Data::Dumper any help is greatly appreciated. One thing is the "name" : "someuser", that is outside of the entryArray someuser is some random ip address i was just doing find replace to get rid of data I shouldn't be uploading. Also I do need to print the IP addresses with the entryArray information.


    $VAR1 = '{ "alertCounts" : [ { "count" : 6, "rule" : "rule1" }, { "count" : 26, "rule" : "rule2" }, { "count" : 10, "rule" : "rule3" }, { "count" : 20862, "rule" : "rule4" }, { "count" : 2, "rule" : "rule5" }, { "count" : 1108, "rule" : "rule6" }, { "count" : 1, "rule" : "rule7" } ], "balArray" : [ { "containerArray" : [], "name" : "someuser", }, { "containerArray" : [ { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 18, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:45:21.450" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 5, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:25:26.496" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 186, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:13:03.648" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 78, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:24:59.053" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 296, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:09:10.389" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 9, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:51:55.386" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 59, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:25:40.993" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 46, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:31:40.723" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 92, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:19:40.335" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 108, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:20:11.072" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:39:11.728" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 92, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:21:03.079" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 73, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:23:55.397" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 80, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:25:38.992" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 65, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:25:06.585" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 52, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:28:44.916" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 166, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:14:09.754" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 80, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:21:43.769" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 89, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:23:21.909" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 165, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:14:26.891" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 51, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:34:29.908" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 37, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:37:02.962" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 104, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:18:53.823" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 127, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:17:53.642" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 16, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:47:42.639" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 129, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:16:01.194" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 138, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:17:11.180" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 133, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:17:49.375" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:42:51.472" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 159, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:14:01.750" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:07:47.046" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 30, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:25:01.247" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 1107, "name" : "someuser", "priority" : 4, "rule" : "rule6", "timestamp" : "13:11:36.774" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 25, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:35:54.151" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:26:34.428" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:25:12.718" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 109, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:18:24.025" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 258, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:10:19.688" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 137, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:16:35.024" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 7, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:51:46.370" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 47, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:38:55.147" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 91, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:20:17.864" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 370, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:07:19.953" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 60, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:24:18.640" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 62, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:26:51.900" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 70, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:27:55.890" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 96, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:21:28.590" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 55, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:30:33.235" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 92, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:18:18.484" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 3, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:55:32.464" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 92, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:21:03.350" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 103, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:19:33.137" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 16, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:46:19.761" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 69, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:22:07.128" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 50, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:27:27.263" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 9, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:55:44.319" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 10, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:28:08.453" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 155, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:14:28.274" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 7, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:53:52.007" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 53, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:31:14.889" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 75, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:22:30.611" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 101, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:20:41.301" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 26, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:32:42.203" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 60, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:37:53.035" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:49:49.294" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 64, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:26:57.377" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 89, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:20:58.840" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 118, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:17:58.274" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 68, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:23:01.513" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 1, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:58:21.413" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 28, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:36:54.367" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 246, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:08:54.720" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 107, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:19:02.920" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 95, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:20:06.766" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 59, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:28:47.268" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 78, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:28:15.291" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 70, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:25:16.057" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:55:33.739" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 27, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:41:10.732" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 11, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:50:21.418" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:40:45.101" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:28:28.350" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 29, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:47:19.169" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:54:50.891" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 92, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:19:12.052" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 63, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:33:54.418" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 28, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:35:37.964" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 22, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:47:11.510" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 98, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:21:35.286" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 39, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:31:45.540" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 4, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:51:39.252" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 94, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:20:31.262" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 48, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:35:21.643" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:57:48.327" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:58:06.806" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 60, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:32:18.302" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 68, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:24:59.984" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 157, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:14:33.122" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 172, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:13:55.531" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 208, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:11:36.919" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 104, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:19:51.946" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 85, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:22:49.604" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 86, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:22:07.661" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 124, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:17:26.999" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 61, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:28:03.499" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 112, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:19:11.520" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:51:33.303" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 67, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:24:59.377" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 375, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:08:30.886" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 503, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:05:14.528" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 40, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:38:10.958" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 12, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:52:29.655" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 125, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:17:43.160" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 6, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:45:27.855" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 54, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:26:34.714" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 152, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:15:30.748" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:34:32.100" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 68, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:24:02.753" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 8, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:51:17.444" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:29:39.832" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 123, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:17:36.065" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 139, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:16:15.328" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 227, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:10:29.040" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 11, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:51:33.375" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 9, "name" : "someuser", "priority" : 3, "rule" : "rule3", "timestamp" : "13:56:34.017" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 144, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:15:53.114" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 105, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:20:53.631" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 58, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:25:33.342" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 0, "name" : "someuser", "priority" : 4, "rule" : "rule2", "timestamp" : "13:07:02.753" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 96, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:24:47.950" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 33, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:36:03.061" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 33, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:30:56.291" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 96, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:21:29.645" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 187, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:12:00.918" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 6, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:53:55.358" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 94, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:20:51.017" } ], "name" : "someuser", }, { "entryArray" : [ { "action" : "flag", "expires" : "00:00:00", "hitsSinceAdded" : 189, "name" : "someuser", "priority" : 4, "rule" : "rule4", "timestamp" : "13:10:26.706" } ], "name" : "someuser", },
      Turns out the json im trying to post got cut off just fyi for the full call see below:

      http://scsys.co.uk:8002/208812

        You will need to learn how to read JSON data. Fortunately, JSON is almost a subset of Perl syntax, so perlref (and maybe References Quick Reference will get you along nicely. Then you will need to reduce your JSON message to something that is allowable to post here. Please show some effort.

        You have , at the end of your arrays. This isn't valid JSON.

        Not sure how I didn't see all the other replies above, ignore.

      Here's a tip for using Perlmonks: if you have a large chunk of code (or, in your case, JSON), it's best if you wrap that in READMORE tags so that the entire chunk of text doesn't display in its entirety. This saves bandwidth.

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://996409]
Approved by BrowserUk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2014-09-23 04:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (210 votes), past polls