Is null valid JSON (4 bytes, nothing else)

前端 未结 2 977
别那么骄傲
别那么骄傲 2020-12-03 06:30

Hot debate today:

Is the text stream null valid JSON?

According to http://www.ietf.org/rfc/rfc4627.txt?number=4627:

...

2条回答
  •  再見小時候
    2020-12-03 07:09

    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.

提交回复
热议问题