Robert Altman Robert Altman - 4 years ago 210
JSON Question

Is null valid JSON (4 bytes, nothing else)

Hot debate today:

Is the text stream

valid JSON?

According to


2. JSON Grammar

A JSON text is a sequence of tokens. The set of tokens includes
six structural characters, strings, numbers, and three literal

A JSON text is a serialized object or array.

Should this interpreted as both statements must be true in order for the text to be valid JSON?

However, many other libraries seem to permit it, and indeed, it seems like a single valid token could be a legitimate result.

Is there a definitive answer?

Answer Source

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 [].

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download