I know this should be very basic , but I am struggling to find answer , spent 5 minutes figuring out how to compose title for this question :)
var response = [{id:1 , name:"Some Name"} , {id:2 , name :"Other Name"}]
var prefixResponse = "users";
var newResponse = {prefixResponse : response }
This will not work as you know , what I need is that newResponse should look like
{users:[{id:1 , name:"Some Name"} , {id:2 , name :"Other Name"}]}
Is this possible to achieve without using JSON striginfy than converting back to JSON
I know it is simple but coming from PHP this is trouble for me :(