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

413
Views
cómo recuperar datos de JSON en javascript @
let data = { "@type": "Movie", "url": "/title/tt0443272/", "name": "Lincoln", "image": "https://m.media-amazon.com/images/M/MV5BMTQzNzczMDUyNV5BMl5BanBnXkFtZTcwNjM2ODEzOA@@._V1_.jpg", "description": "As the American Civil War continues to rage, America's president struggles with continuing carnage on the battlefield as he fights with many inside his own cabinet on the decision to emancipate the slaves.", "duration": "PT2H30M" } console.log(data.@type)

tengo grandes datos json de scrping pero no sé cómo obtener el valor de los datos cuya clave comienza con "@"

¿Cómo puedo obtener el valor de @type?

cuando uso este método, tengo un error: -

SyntaxError: token no válido o inesperado

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

0

Solo haz console.log(data['@type'])

 let data = { "@type": "Movie", "url": "/title/tt0443272/", "name": "Lincoln", "image": "https://m.media-amazon.com/images/M/MV5BMTQzNzczMDUyNV5BMl5BanBnXkFtZTcwNjM2ODEzOA@@._V1_.jpg", "description": "As the American Civil War continues to rage, America's president struggles with continuing carnage on the battlefield as he fights with many inside his own cabinet on the decision to emancipate the slaves.", "duration": "PT2H30M" } console.log(data['@type'])

about 4 years ago · Juan Pablo Isaza Report

0

También puede acceder a las propiedades de las variables usando la notación de soporte , como si fuera una clave -> valor:

 let data = { "@type": "Movie", "url": "/title/tt0443272/", "name": "Lincoln", "image": "https://m.media-amazon.com/images/M/MV5BMTQzNzczMDUyNV5BMl5BanBnXkFtZTcwNjM2ODEzOA@@._V1_.jpg", "description": "As the American Civil War continues to rage, America's president struggles with continuing carnage on the battlefield as he fights with many inside his own cabinet on the decision to emancipate the slaves.", "duration": "PT2H30M" } console.log(data["@type"])

about 4 years ago · Juan Pablo Isaza Report

0

Las variables en JavaScript solo pueden comenzar con una letra, un signo de dólar o un guión bajo.

Cuando usa un nombre de variable no válido, no puede usar la notación de puntos y debe usar la notación de corchetes

Inválido

 data.@type

Correcto

 data['@type']
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!