I am trying to create JSON object with the following format.
{
"tableID": 1,
"price": 53,
"payment": "cash",
"quantity": 3,
"products": [
{
"ID": 1,
"quantity": 1
},
{
"ID": 3,
"quantity": 2
}
]
}
I know how to do this statically using JSONObject and JSONArray. But I need a more dynamic way cause the products array must be implemented so it has many objects not just 2.
IS there a way to delete the contents of a JSONObject? eg I have the following JSONobject
{ "ID": 3, "quantity": 2 }
Could I somehow erase its values so i can reuse the object in an iteration?