Thanks. That's exactly the information I needed.

EDITED to add: the question below has been answered. Thanks so much.

Now I have another ignorant question. Below is my current working code. How do I get the size of the JSON object $json_string, and how do I loop over the first index?

use strict; use warnings; use Mojo::UserAgent; use LWP::UserAgent; use HTTP::Request::Common qw(GET); # use JSON; use Data::Dump qw(dd); my $outputFilename = "test_output.txt"; my $fh_data; my $urlkey_result; my $timestamp_result; my $original_result; my $mimetype_result; my $statuscode_result; my $digest_result; my $length_result; 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_string = $ua->get($url)->res->json; # dd $json_string; # for debug $urlkey_result = $json_string->[0][0]; $timestamp_result = $json_string->[0][1]; $original_result = $json_string->[0][2]; $mimetype_result = $json_string->[0][3]; $statuscode_result = $json_string->[0][4]; $digest_result = $json_string->[0][5]; $length_result = $json_string->[0][6]; print $fh_data "\n$urlkey_result\t$timestamp_result\t$original_result\ +t$mimetype_result\t$statuscode_result\t$digest_result\t$length_result +"; $urlkey_result = $json_string->[1][0]; $timestamp_result = $json_string->[1][1]; $original_result = $json_string->[1][2]; $mimetype_result = $json_string->[1][3]; $statuscode_result = $json_string->[1][4]; $digest_result = $json_string->[1][5]; $length_result = $json_string->[1][6]; print $fh_data "\n$urlkey_result\t$timestamp_result\t$original_result\ +t$mimetype_result\t$statuscode_result\t$digest_result\t$length_result +"; $urlkey_result = $json_string->[2][0]; $timestamp_result = $json_string->[2][1]; $original_result = $json_string->[2][2]; $mimetype_result = $json_string->[2][3]; $statuscode_result = $json_string->[2][4]; $digest_result = $json_string->[2][5]; $length_result = $json_string->[2][6]; print $fh_data "\n$urlkey_result\t$timestamp_result\t$original_result\ +t$mimetype_result\t$statuscode_result\t$digest_result\t$length_result +"; $urlkey_result = $json_string->[3][0]; $timestamp_result = $json_string->[3][1]; $original_result = $json_string->[3][2]; $mimetype_result = $json_string->[3][3]; $statuscode_result = $json_string->[3][4]; $digest_result = $json_string->[3][5]; $length_result = $json_string->[3][6]; print $fh_data "\n$urlkey_result\t$timestamp_result\t$original_result\ +t$mimetype_result\t$statuscode_result\t$digest_result\t$length_result +"; close $fh_data;

In reply to Re^2: 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.