In principle, you can send any content in HTTP request, it only need to be serializable into a string. So, it could be multiple JSON object. I don't even understand where you could get stuck.
However, you are not trying to send 2 or more. And that is reasonable. What you called "JSON with 2 objects" is nothing but just one JSON string which will be parsed into
one object. This object is the top-level array. You cannot even say "with 2 objects". It's one object with two element objects, inner array, each having three element objects, each having three properties.
Therefore,
the problem you are concerned with simply does not exist. And if it ever appears, you can always reduce it to one object, by wrapping your N objects in an outer object having two properties. Exactly as in your JSON sample.
Some background: perhaps you need to understand that JavaScript is a
loose-type language; and all arrays and
'{...}'
objects are exactly the same things of the "type"
'object'
:
associative containers (arrays) providing access to the elements by keys of any types. The only difference an array makes is that it has the
length
property. Please see:
http://en.wikipedia.org/wiki/JavaScript#Dynamic[
^],
http://en.wikipedia.org/wiki/Associative_array[
^],
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object[
^],
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array[
^].
See also:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON[
^].
—SA