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

408
Vistas
how to retrive data from JSON in 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)

i have large json data from scrping but i don't know how to get value of data whose key is starting from "@"

how can i get value of @type

when i am use this method i got error :-

SyntaxError: Invalid or unexpected token

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

0

Just do 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 Denunciar

0

You can access variable properties using the Bracket notation as well, like if its a key -> value:

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 Denunciar

0

Variables in JavaScript can only start either a letter, dollar sign, or underscore.

When using an invalid variable name you cannot use dot notation and must use bracket notation

Invalid

data.@type

Correct

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