解析JSON数据不包括引号与jQuery [英] Parsing JSON data without quotes with jQuery

查看:108
本文介绍了解析JSON数据不包括引号与jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图解析JSON与jQuery我从通过AJAX远程服务器获取。 JSON数据是这样的: {标识符:ID,标签:标签} 却无力。显然,该领域标识符和标签没有双引号。它的工作原理时,在我的本地测试网站用双引号进行测试。

I'm trying to parse JSON with jQuery I get from a remote server through AJAX. The JSON data is like: {identifier:"ID", label:"LABEL"} but unable to. Apparently, the field identifier and label has no double quotes. It works when tested on my local test site with double quotes.

可不可以这样做没有引号用jQuery工作?我已搜查四周,没有发现任何解决方案。

Can it be made to work without quotes with jQuery? I have searched around and have found no solutions.

任何输入AP preciated。谢谢你。

Any input is appreciated. Thanks.

推荐答案

您不能。 JSON规范是:

You can't. JSON specification says this:

A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. A string is very much like a C or Java string.

含义字符串作为你提到的标签。

Meaning string as the label you mention.

来源: http://www.json.org/

这篇关于解析JSON数据不包括引号与jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆