JSON中的空格字符是否无关紧要? [英] Are whitespace characters insignificant in JSON?
本文介绍了JSON中的空格字符是否无关紧要?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
json字符串中是否忽略空格,制表符和回车符等空白字符?
Are blank characters like spaces, tabs and carriage returns ignored in json strings?
例如,{"a":"b"}
是否等于{"a" : "b"}
?
推荐答案
是的,在语法中会忽略双引号字符串文字之外的空格.具体来说, RFC 4627 中JSON语法中的ws
生成显示:
Yes, blanks outside a double-quoted string literal are ignored in the syntax. Specifically, the ws
production in the JSON grammar in RFC 4627 shows:
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
)
这篇关于JSON中的空格字符是否无关紧要?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文