Hot debate today:
Is the text stream null
valid JSON?
According to http://www.ietf.org/rfc/rfc4627.txt?number=4627:
...
[Note! This answer is no longer correct, see answer by @niksnut.]
Yes, both statements must be true. The literal token null
is a JSON value. A JSON text is a serialized object or array, which requires {} or [].
RFC 7159 drops the limitation that a JSON text must be an object or an array. The grammar specifies:
JSON-text = ws value ws
where
value = false / null / true / object / array / number / string
Thus, "null" is now a valid JSON document.