This object literal is valid JSON:
{ "foo" : "bar"}
And so is this array literal:
["foo", "bar", 1, 2, 3, null]
But what about a string by itself?
"foo"
Or a number by itself?
0
Recent JSON specs (RFC 7159 Mar 2014, and ECMA-404) define a JSON text as optional whitespace surrounding any JSON value, where a value is any one of:
(see the start of sections 2. JSON Grammar, and 3. Values)
Older JSON specs (RFC 4627, obsoleted) only allowed the top-level element to be an object or an array.