我有以下格式的 Json:
var response1="{" +
"\"code\":\"200\"," +
"\"requestID\":\"1002\"," +
"\"body\":\"[{" +
"\\\"author\\\":\\\"sumit\\\"," +
"\\\"id\\\":\\\"ABX-002\\\"," +
"\\\"title\\\":\\\"How to make Android APK in 2 seconds :)\\\"" +
"}," +
"" +
"{" +
"\\\"author\\\":\\\"sumit\\\"," +
"\\\"id\\\":\\\"ABX-002\\\"," +
"\\\"title\\\":\\\"How to make Android APK in 2 seconds :)\\\"" +
"}," +
"{"+
"\\\"author\\\":\\\"sumit\\\"," +
"\\\"id\\\":\\\"ABX-002\\\"," +
"\\\"title\\\":\\\"How to make Android APK in 2 seconds :)\\\"" +
"}" +
"]\"," +
"\"headers\":{\"Server\":\"Apache-Coyote/1.1\"," +
"\"Content-Type\":\"text/xml\"," +
"\"Content-Length\":\"131\"," +
"\"Date\":\"Thu, 06 Sep 2012 09:10:26 GMT\"" +
"}" +
"}";
我想解析 Content-Type Key 。所以我写了下面的代码来解析这个值:
var jsonResponse = jQuery.parseJSON(response1);
var contentType = jsonResponse.headers.Content-Type;
我无法获取 Content-Type 和 Content-Length 的值。任何帮助,将不胜感激。非常感谢