I'm confused.
    my $json_string = $ua->get($url)->res->json;
Is $json_string in fact a string, or is it a decoded JSON object as shown in the example here, i.e., a reference to an array of arrays (in that particular example)? Your use of the $json_string->[0][0] syntax suggests the latter.

If $json_string is in fact a ref. to an AoA, you might do something like this:

Win8 Strawberry 5.30.3.1 (64) Mon 05/09/2022 14:30:45 C:\@Work\Perl\monks >perl use strict; use warnings; use JSON; use Data::Dump qw(dd); my $json_string = <<'EOJ'; [["urlkey","timestamp","original","mimetype","statuscode","digest","le +ngth"], ["org,archive)/", "19970126045828", "http://www.archive.org:80/", "text/html", "200", "Q4YULN754FHV2U6Q5JUT6Q2P57WEWNNY", "1415"], ["org,archive)/", "19971011050034", "http://www.archive.org:80/", "text/html", "200", "XAHDNHZ5P3GSSSNJ3DMEOJF7BMCCPZR3", "1402"], ["org,archive)/", "19971211122953", "http://www.archive.org:80/", "text/html", "200", "XAHDNHZ5P3GSSSNJ3DMEOJF7BMCCPZR3", "1405"]] EOJ my $ar_decoded_json = decode_json $json_string; # dd $ar_decoded_json; # for debug for my $ar_jentry (@$ar_decoded_json) { # handle each decoded JSON en +try printf "\n'%s' '%s' '%s' '%s' '%s' '%s' '%s'", @$ar_jentry; } ^Z 'urlkey' 'timestamp' 'original' 'mimetype' 'statuscode' 'digest' 'leng +th' 'org,archive)/' '19970126045828' 'http://www.archive.org:80/' 'text/ht +ml' '200' 'Q4YULN754FHV2U6Q5JU T6Q2P57WEWNNY' '1415' 'org,archive)/' '19971011050034' 'http://www.archive.org:80/' 'text/ht +ml' '200' 'XAHDNHZ5P3GSSSNJ3DM EOJF7BMCCPZR3' '1402' 'org,archive)/' '19971211122953' 'http://www.archive.org:80/' 'text/ht +ml' '200' 'XAHDNHZ5P3GSSSNJ3DM EOJF7BMCCPZR3' '1405'
(I used different formatting just to try to make things fit better and to clearly delineate the strings. Sorry about the wraparound.)


Give a man a fish:  <%-{-{-{-<


In reply to Re^3: reading a JSON object by AnomalousMonk
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.