in reply to Re^3: reading a JSON object
in thread reading a JSON object
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: reading a JSON object
by AnomalousMonk (Archbishop) on May 09, 2022 at 20:47 UTC | |
by anautismobserver (Sexton) on May 09, 2022 at 21:39 UTC | |
by anautismobserver (Sexton) on May 09, 2022 at 21:58 UTC |