【发布时间】:2013-09-19 17:05:38
【问题描述】:
您好,我的服务器端返回了以下 JSON:
{"command":"SELECT","rowCount":1,"oid":null,"rows":[{"username":"xxxx"}],"fields":[{"name":"username","tableID":34722,"columnID":3,"dataTypeID":1043,"dataTypeSize":-1,"dataTypeModifier":204,"format":"text"}],"_parsers":[null]}
我正在像这样在 javascript 中解析 json:
var ParsedJSONResponse = $.parseJSON(JSONResponseFromServerSide);
变量为"ParsedJSONResponse" 始终为空,我的 JSON 有效 我在 JSONLint 中检查了它,请问发生了什么?
【问题讨论】:
-
您知道,如果您输入
contentType:JSON,jQuery 会为您解析并最终返回一个 JSON 对象。 -
看起来该值已经是一个对象而不是json字符串,所以不需要再次解析它