I have a JSON array which I receive from a HTTP request :
[
'{{repeat(5, 7)}}',
{
_id: '{{objectId()}}'
}
]
At times I receive only a simply JSON object and not an array.
How do I generalize and store the response, since sometimes I get as an array and sometimes as a normal JSON object.
Currently I have done it this way: JSONObject j = new JSONObject(recvdString);
In the case of JSON array I get an error: A JSONObject text must begin with '{' at character 1 of