Home > Enterprise >  How to add new attribute to JSON object using JavaScript?
How to add new attribute to JSON object using JavaScript?

Time:11-10

How do I add new attribute to JSON object using JavaScript? I want to add a new attribute to JSON object.

CodePudding user response:

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.

  • Related