I saw many questions in Stackoverflow but i didn't find what exactly responds to my query.
I need to add an element to my json object:
var JSONObject = {
"shape0": {
"id": "id0",
"x1": 0,
"x2": 0,
"y1": 0,
"y2": 0
},
"shape1": {
"id": "id1",
"x1": 2,
"x2": 2,
"y1": 2,
"y2": 2
}
};
I used this syntax but in vain:
var newShape = "shape2";
JSONObject.newShape.id = "id2";
NOTE: The first thing, is that a json object? Any help will be appreciated