Sometimes, we want to access JSON property with "-" dash with JavaScript.
In this article, we’ll look at how to access JSON property with "-" dash with JavaScript.
How to access JSON property with "-" dash with JavaScript?
To access JSON property with "-" dash with JavaScript, we can use a string.
For instance, we write
const profileId = jsonObj["profile-id"];
to access the profile-id
property from jsonObj
with jsonObj["profile-id"]
.
Conclusion
To access JSON property with "-" dash with JavaScript, we can use a string.