I have a json of the below format
{
"name": "Stub",
"request": {
"method": "GET",
"url": "/thing/1/4"
},
"response": {
"status": 200
}
}
I would like to add the below part to my json
"queryParameters": {
"Accept": {
"equalTo": "xml"
}
}
so my final outcome is of the below format
{
"name": "Stub",
"request": {
"method": "GET",
"url": "/thing/1/4",
"queryParameters": {
"Accept": {
"equalTo": "xml"
}
}
},
"response": {
"status": 200
}
}
I tried the below but it doesn't seem to help, I also tried to parse which didn't help either
obj['theTeam'].push("queryParameters": { "Accept": { "equalTo": "xml" } });
jsonStr = JSON.stringify(obj);
push()is an array method but you are working with an object literal not array