Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

165
Vistas
Call a specific array in a JSON API call

I'm trying to call the API but it doesn't return me anything. I'm calling it like: res.on('data', d => { const RetrieveFromApi = JSON.parse(d).FLUX.quote.USD.price;.

The API is successfully called since I can see it in the API history, and data is defined as d.

API Call

Can you help me please?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

from your screen provided in comment, you passed one property you don't access to it which is data So just add property data before FLUX

JSON.parse(d).FLUX.quote.USD.price;
             ^data.FLUX.quote.USD.price;
about 4 years ago · Juan Pablo Isaza Denunciar

0

From the image of the log the object seems incomplete at the end, did you try to use JSON.stringify(d) to see if there are any errors on the json object? or copy the response on https://jsonlint.com to check?

Because the error message points that the parse doesn't find a valid json object, maybe that is the whole point.

And the other tip is to try to store the value of JSON.parse in an variable before trying to access his values.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda