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

183
Vistas
how to access json field with "-" e.g. 'data-id': 'smth'

I need some help, so I need to access the field in json, I got the json from an API, I know how to access a json but there's one problem, I can't access the field with apostrophe

here's the json I received:

datas: {
  stats: {
    attack: 60
    defense: 70
    'special-defense': 50
    speed: 90
  }
}

I want to access the special-defense, I have tried datas.stats.special-defense but isn't working, I tried datas.stats.'special-defense' too and it's giving invalid syntax. I can access another field like speed,attack, and defense with datas.stats.speed etc.

is there any way to access that field?

about 4 years ago · Juan Pablo Isaza
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