Example: Is the following code valid against the JSON Spec?
{
precision: "zip"
}
Or should I always use the following syntax? (And if so, why?)
{
"precision": "zip"
}
我还没有在JSON规范中找到关于这方面的内容.尽管他们在示例中使用了引号.
Example: Is the following code valid against the JSON Spec?
{
precision: "zip"
}
Or should I always use the following syntax? (And if so, why?)
{
"precision": "zip"
}
我还没有在JSON规范中找到关于这方面的内容.尽管他们在示例中使用了引号.
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"}
.