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

226
Views
How to read values from response object?

I am trying to read a value from a response object, but this

fetch("https://api.nft.storage/upload", options)
          .then((response) => response.json())
          .then((response) => console.log(response))
          .then((response) => {
            console.log(response.value.cid);
            }

... doesn't work. Although my console shows the object being sent:

enter image description here

.. I get this error:

Unhandled Rejection (TypeError): Cannot read properties of undefined (reading 'value')

1056 | .then((response) => response.json())
  1057 | .then((response) => console.log(response))
  1058 | .then((response) => {
> 1059 |   console.log(response.value.cid);

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

console.log() doesn't return anything, so response in the next .then() is undefined. Just do both in the same function.

fetch("https://api.nft.storage/upload", options)
  .then((response) => response.json())
  .then((response) => {
    console.log(response);
    console.log(response.value.cid);
  }
}
about 4 years ago · Juan Pablo Isaza Report
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!