I have a JSON object called arrayToSubmit
. Here is the following code:
location = "Johannesburg, South Africa";
type = "bench";
qty = 1;
assetNumber = 15;
arrayToSubmit = {
location : {
type : {
'qty' : qty,
'assetNumber' : assetNumber
}
}
}
But the result in chrome is as follows:
Object{location { type : {"qty" : "1", "assetNumber" : "15"}}}
I need to replace the words location and type with the variables in the initial code, like this:
Object{"Johannesburg, South Africa" = { "bench" = {"qty" - "1", "assetNumber" : "15"}}}
(I am pulling these values from my page, I just typed them out here for ease of use).
I have already tried these two examples, but don't know how to get it in multi level format.