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

172
Views
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
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!