Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: decoding a JSON object

by marto (Cardinal)
on Nov 23, 2022 at 13:39 UTC ( #11148319=note: print w/replies, xml ) Need Help??


in reply to decoding a JSON object

The same as the last time you asked, and the time before that :P

#!/usr/bin/perl use strict; use warnings; use Mojo::UserAgent; use feature 'say'; my $url_food = 'https://api.nal.usda.gov/fdc/v1/food/170581?api_key=O +c4bD3tFWgPAscW0R0gBRivwqEdt0N182PXCGNQO'; my $ua_food = Mojo::UserAgent->new; my $json_food = $ua_food->get($url_food)->res->json; say $json_food->{fdcId}; foreach my $nutrients( @{$json_food->{'foodNutrients'}} ){ say $nutrients->{'nutrient'}{'name'}; }

Replies are listed 'Best First'.
Re^2: decoding a JSON object
by anautismobserver (Sexton) on Nov 23, 2022 at 18:48 UTC

    You're right (and diligent). Sorry for wasting your time. I was tired and frustrated and not thinking clearly.

      It happens to us all, and these are the right circumstances to ask others for help. Don't worry about it :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11148319]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2023-03-27 10:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (65 votes). Check out past polls.

    Notices?