How do I add new attribute to JSON object using JavaScript? I want to add a new attribute to JSON object.
Asked
Active
Viewed 40 times
-1
-
https://stackoverflow.com/questions/736590/add-new-attribute-element-to-json-object-using-javascript is this what you're asking? – WOUNDEDStevenJones Nov 09 '22 at 19:49
-
https://stackoverflow.com/questions/736590/add-new-attribute-element-to-json-object-using-javascript – ByGio1 Nov 09 '22 at 19:49
1 Answers
0
JSON stands for JavaScript Object Notation. A JSON object is really a string that has yet to be turned into the object it represents.
To add a property to an existing object in JS you could do the following.
object["property"] = value;
or
object.property = value;
If you provide some extra info like exactly what you need to do in context you might get a more tailored answer.

Gabriel Aoki
- 331
- 1
- 5
- 16