in reply to Re: Trying to decode JSON streaming from a website
in thread Trying to decode JSON streaming from a website

I added commas to the end of each line, and now JSON::SL is trying to decode at least now I'm getting a hash ref error...
JSON Stream parser test Received: {"sequenceNumber":1402012831,"frequency":7077409,"mode":"JT65","sNR":- +21,"flowStartSeconds":1492208570,"senderCallsign":"EB5JRL","senderLoc +ator":"IM99SL","receiverCallsign":"ON3HPI","receiverLocator":"JO20et" +,"receiverDecoderSoftware":"JTDX v17.7"}, Can't use string ("1402012831") as a HASH ref while "strict refs" in u +se at client.pl line 38.
Should it not be using "sequenceNumber" as the reference and "1402012831" as the data? The line it fails on is  print "$obj->{Value}{flowStartSeconds}: $obj->{Value}{senderCallsign}\n"; If I use Data::Dumper the first element looks like below, could it be I've got my JSON pointer wrong so it's not looking at the whole line?
$VAR1 = { 'Value' => 1402024539, 'Path' => '/sequenceNumber', 'JSONPointer' => '/^' };
I'm not overly strong in OO Perl, I know I should how to use it more. Thanks

Replies are listed 'Best First'.
Re^3: Trying to decode JSON streaming from a website
by Corion (Patriarch) on Apr 15, 2017 at 07:35 UTC

    I don't know JSON::SL, but it seems that you have to configure it better to call your code at different times than it currently does.

    I don't know what kind of JSON path spec it implements, but have you tried just using / instead of /^?

    If you post a short, self-contained program that still reproduces the error, then we can give help more to the point than just guess about your data, your code and the behaviour of JSON::SL. See also SSCCE.