Do the JSON keys have to be surrounded by quotes?(转载)

Or should I always use the following syntax? (And if so, why?)

I haven’t really found something about this in the JSON specifications. Although they use quotes around their keys in their examples.

Yes, you need quotation marks. This is to make it simpler and to avoid having to have another escape method for javascript reserved keywords, ie {for:”foo”}.

Original: https://www.cnblogs.com/OpenCoder/p/13588195.html
Author: PowerCoder
Title: Do the JSON keys have to be surrounded by quotes?(转载)

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/552866/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球