Javascript 正确的JSON格式
这是正确的json格式吗Javascript 正确的JSON格式,javascript,jquery,ajax,json,Javascript,Jquery,Ajax,Json,这是正确的json格式吗 { "count": { "hbase": 66, "java": 63, "spring": 41, "Sample": 39, "minify": 36, "TS-WS1": 28, "jprofiler": 26, "logging": 24, "SCM": 24, "csrfguard": 20,
{
"count": {
"hbase": 66,
"java": 63,
"spring": 41,
"Sample": 39,
"minify": 36,
"TS-WS1": 28,
"jprofiler": 26,
"logging": 24,
"SCM": 24,
"csrfguard": 20,
"ldap": 19,
"hadoop": 18,
"jquery": 18,
"android": 17,
"TS-WS2": 17,
"myplace": 16,
"jvm": 16,
"daily": 15,
"oops": 15,
"node.js": 15,
"long": 15,
"css3": 13,
"html5": 13,
"jms": 13,
"ci": 11,
"node": 11,
"backlog": 11,
"jsf": 10,
"groovy": 10,
"outofmemory": 9,
"adf": 9,
"Exception": 9,
"guidelines": 9,
"abc": 9,
"liferay": 8,
"performance": 7,
"Groovy": 7,
"jenkin": 7,
"Hadoop": 6,
"Learning": 6,
"code": 6,
"design": 6,
"CTT4TL": 6,
"": 6,
"eclipse": 5,
"templates": 5,
"apache": 5,
"Node.JS": 5,
"analytics": 5,
"cap": 4,
"CSRFGuard": 4,
"corba": 4,
"pattern": 4,
"EST-WS1": 4,
"web": 4,
"formatter": 4,
"Minify": 4,
"guava": 3,
"oracle": 3,
"security": 3,
"checklists": 3,
"lda": 3,
"ana": 3,
"bi": 3,
"ctt4tl": 3,
"est-ws2": 3,
"exception": 3,
"EST-WS2": 3,
"oop": 3,
"how": 3,
"hibernate": 3,
"LDAP": 2,
"cxf": 2,
"Scala": 2,
"interceptor": 2,
"hudson": 2,
"jenkins": 2,
"sonar": 2,
"viva": 2,
"nfr": 2,
"java7": 2,
"CSS3": 2,
"jpa": 2,
"ppt": 2,
"Hudson": 2,
"template": 2,
"des-ws3": 2,
"Hadoop\/HBase": 1,
"secur": 1,
"csrf": 1,
"DB": 1,
"university": 1,
"abcd": 1,
"jsa": 1,
"LOGGING": 1,
"json": 1,
"rm": 1,
"TS-SCM": 1,
"nak": 1,
"fad": 1,
"presentation": 1,
"est-ws1": 1,
"terna": 1,
"lucene": 1,
"coding": 1,
"log4j": 1,
"JPA": 1,
"theme": 1,
"training": 1,
"secu": 1,
"build": 1,
"css": 1,
"project": 1,
"solr": 1,
"DES-WS": 1,
"intercep": 1,
"test": 1
},
"date": MonMay0612: 19: 48IST2013
}
我在一次ajax调用中收到这个JSON。在收到它之后,会显示“parserror”。
我的密码-
$.ajax({
type: "GET",
url: jsonURL + SEARCH_HISTORY_JSON + EXT_JSON,
dataType: "json",
contentType: "application/json",
async : false,
success: function(data) {
},
error: function(xhr, status, error) {
/* $("#tagCloud").html(getMessage(tagcloud.error));
$("#searchHistory").hide();*/
alert(status);
console.log(status);
}
});
另外,请告诉我如何访问此数据。我应该像data.data和data.count那样访问它吗?问题出在“日期”字段上。
您应该将日期字段视为字符串
此外,我建议为此使用UNIX时间,因为它更容易从javascript解析
在成功功能中,您可以访问“计数”字段,如数据。计数
问题在于“日期”字段。
Parse error on line 121:
... }, "date": MonMay0612: 19: 48IS
---------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
您应该将日期字段视为字符串
此外,我建议为此使用UNIX时间,因为它更容易从javascript解析
在成功功能中,您可以访问“计数”字段,如data.count
Parse error on line 121:
... }, "date": MonMay0612: 19: 48IS
---------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
你得把你的约会安排成这样-
"date": "MonMay0612: 19: 48IST2013"
你得把你的约会安排成这样-
"date": "MonMay0612: 19: 48IST2013"
第121行的分析错误:
... }, “日期”:周一12:19:48
---------------------^
应为“STRING”、“NUMBER”、“NULL”、“TRUE”、“FALSE”、“{”、“[”
这是一种非常简单的方法来过滤JSON。
第121行的分析错误:
日期:周一12:19:48
---------------------^
应为“STRING”、“NUMBER”、“NULL”、“TRUE”、“FALSE”、“{”、“[”
这是一种非常简单的删除JSON的方法。更改日期格式如下:
"date":"Mon May 06 12:19:48 IST 2013"
&遵循json在线编辑器。即chrome:更改日期格式,如下所示:
"date":"Mon May 06 12:19:48 IST 2013"
&遵循json在线编辑器,即chrome:问题出在
日期
字段上
请使用“MonMay0612:19:48IST2013”传递
日期字段值问题出在日期字段上
请使用“MonMay0612:19:48IST2013”传递date
字段值,
这是您需要的,并且“date”之后的值是错误的,应该引用。这是您需要的,也是“date”之后的值是错误的,应该引用。奇怪…因为我使用JSON简单库创建了它,比如-JSONObject JSON=new JSONObject();JSON.put(“date”,formattedDate);JSON.put(“count”,sortedWords);writeFile(configBundle.getString(“log.searches.count.file”)、JSON.toJSONString();奇怪…因为我使用JSON简单库创建了它,比如-JSONObject JSON=new JSONObject();JSON.put(“date”,formattedDate);JSON.put(“count”,sortedWords);writeFile(configBundle.getString(“log.searches.count.file”);JSON.toJSONString();