0

Im trying to access an element in JSON With Hyphen in the property name

id("main").textContent = jsonData.res.main-result;

but that is causing an error

1 Answers1

1

const json = {
  'property-name': 'something'
}

console.log(json['property-name']);

Use jsonData.res['main-result']

Ehsan Mahmud
  • 725
  • 4
  • 11