Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

78
Views
Using fetch to log/output json values

I'm trying to fetch values from JSON, see below. I need the values for the very last "year", "month", "day", "cycle", "trend" in the object

{"co2":[{"year":"2012","month":"1","day":"1","cycle":"392.92","trend":"391.50"},
...
,{"year":"2022","month":"2","day":"20","cycle":"418.63","trend":"416.80"}]}

I've tried the following script, but it logs [object Object]. Any ideas? Thanks in advance.

    async function loadnums() {
        const response = await fetch('https://global-warming.org/api/co2-api');
        const nums = await response.json();
        console.log(nums); 
    }
    loadnums();

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!