Question:
How to set the correct format of a simple array in JSON with only a key? I do it like this, swears:
{
"1",
"2",
"3",
"4"
}
Answer:
JSON data ( RFC 4627 ) is:
- Objects
{ ... }
or - Arrays
[ ... ]
or - Values of one of the types:
- strings in double quotes,
- number,
- boolean
true
/false
, -
null
.
The JSON object looks like this:
{"ключ":значение, "ключ": значение}
And this is what the array looks like:
["значение", "значение"]
In your case, the correct JSON array would be:
[1, 2, 3, 4]
Excerpt from RFC:
A JSON text is a serialized object or array.
JSON-text = object / array