EDITED to add: this has been solved. Thanks so much.

Yes, $json_string is a decoded JSON object, not a string. That's what comes from copy-pasting inappropriately when I don't know what I'm doing.

I can't emphasize enough how useful this feedback is to me. It doesn't just make the difference between easy and hard, it makes the difference between easy and impossible.

My latest problem is that when I try to load the output text file into a Google spreadsheet, I get the following error message (no matter how long I wait beforehand) as soon as I try to manipulate any of the cells:

"There was a problem. These cells are currently being loaded. Please retry when loading completes."

Below is my current working code.

use strict; use warnings; use Mojo::UserAgent; use LWP::UserAgent; use HTTP::Request::Common qw(GET); use Data::Dump qw(dd); my $outputFilename = "test_output.txt"; my $fh_data; open( $fh_data, '>', $outputFilename ) or die "Could not open file '$outputFilename' $!"; my $url = "http://web.archive.org/cdx/search/cdx?url=anautismobserver.wordpress. +com&output=json" ; # &limit=3 my $ua = Mojo::UserAgent->new; my $json_aoa = $ua->get($url)->res->json; # dd $json_aoa; # for debug for my $ar_jentry (@$json_aoa) { # handle each decoded JSON entry printf $fh_data "%s\t%s\t%s\t%s\t%s\t%s\t%s\n", @$ar_jentry; } close $fh_data;

Thank you again.


In reply to Re^4: reading a JSON object by anautismobserver
in thread reading a JSON object by anautismobserver

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.