经过一个小时的谷歌搜索后,我有点不好意思问这个问题。但是 json 中是否允许空字符(ascii null 或\0)?我发现它在 json 字符串中是不允许的,但我的问题是它是否在正文中允许。
那么这样的事情是否有效:
{
"MyKey": "MyValue"\0
}
Run Code Online (Sandbox Code Playgroud)
其中\0是实际的空字符而不是转义字符。
根据 JSON 规范,JSON不能包含\0,令牌之间只能包含空格:
Insignificant whitespace is allowed before or after any of the six
structural characters.
ws = *(
%x20 / ; Space
%x09 / ; Horizontal tab
%x0A / ; Line feed or New line
%x0D ) ; Carriage return
Run Code Online (Sandbox Code Playgroud)
https://www.rfc-editor.org/rfc/rfc7159
| 归档时间: |
|
| 查看次数: |
7504 次 |
| 最近记录: |