正确的JSON格式正确、格式、JSON

2023-09-10 20:46:54 作者:つ莣吥ㄋ

这是正确的JSON格式?

  {
    计数: {
        HBase的:66,
        Java的:63,
        春天:41,
        样品:39,
        运行如下:36,
        TS-WS1:28,
        JProfiler的:26,
        记录:24,
        供应链管理:24,
        csrfguard:20,
        LDAP:19,
        Hadoop的:18,
        jQuery的:18,
        机器人:17,
        TS-WS2:17,
        MyPlace酒店:16,
        JVM:16,
        人民日报:15,
        哎呀呀:15,
        Node.js的:15,
        长:15,
        CSS3:13,
        HTML5:13,
        JMS:13,
        词:11,
        节点:11,
        积压:11,
        JSF:10,
        常规:10,
        内存不足:9,
        ADF:9,
        异常:9,
        指导原则:9,
        ABC:9,
        Liferay的:8,
        业绩:7,
        Groovy的:7,
        詹:7,
        Hadoop的:6,
        学习:6,
        code:6,
        设计:6,
        CTT4TL:6,
        :6,
        月蚀:5,
        模板:5,
        阿帕奇:5,
        Node.js的:5,
        分析:5,
        帽:4,
        CSRFGuard:4,
        CORBA:4,
        图案:4,
        EST-WS1:4,
        网络:4,
        格式化:4,
        缩小:4,
        番石榴:3,
        神谕:3,
        安全:3,
        清单:3,
        LDA:3,
        语录:3,
        比:3,
        ctt4tl:3,
        EST-WS2:3,
        异常:3,
        EST-WS2:3,
        空中接力:3,
        怎么样:3,
        休眠:3,
        LDAP:2,
        CXF:2,
        斯卡拉:2,
        拦截器:2,
        赫德森:2,
        詹金斯:2,
        声纳:2,
        VIVA:2,
        NFR:2,
        java7目录:2,
        CSS3:2,
        JPA:2,
        PPT:2,
        哈德逊:2,
        模板:2,
        DES-WS3:2,
        Hadoop的\ / HBase的:1,
        SECUR:1,
        CSRF:1,
        DB:1,
        大学:1,
        ABCD:1,
        JSA:1,
        记录:1,
        JSON:1,
        RM:1,
        TS-SCM:1,
        NAK:1,
        时尚:1,
        presentation:1,
        EST-WS1:1,
        TERNA:1,
        lucene的:1,
        编码:1,
        log4j的:1,
        JPA:1,
        主题:1,
        培训:1,
        SECU:1,
        建:1,
        CSS:1,
        项目:1,
        Solr的:1,
        DES-WS:1,
        intercep:1,
        测试:1
    },
    日期:MonMay0612:19:48IST2013
}
 

我收到此JSON在我的Ajax调用之一。而刚刚收到后显示parserror。 我的code -

  $。阿贾克斯({
       键入:GET,
       网址:jsonURL + SEARCH_HISTORY_JSON + EXT_JSON,
       数据类型:JSON,
       的contentType:应用/ JSON
       异步:假的,
       成功:功能(数据){
       },
       错误:函数(XHR,状态,错误){
         / * $(#tagCloud)HTML(的getMessage(tagcloud.error))。
           $(#searchHistory)隐藏(); * /
           警报(状态);
           执行console.log(状态);
       }
});
 

也请告诉我如何访问这些数据。我应该访问它像数据。数据和data.count?

解决方案

 解析错误就行121:
...},日期:MonMay0612:19:48IS
--------------------- ^
期待STRING,号码,空,真,假,{,[
 
Ajax 如何 得到后台返回 的json数据,正确的格式应该如何去写

http://jsonlint.com/

您需要把你的约会像这样 -

 日期:MonMay0612:19:48IST2013
 

Is this correct json format?

{
    "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
}

I receive this JSON on one of my ajax call. And just after receiving it shows "parserror". My code -

$.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);
       }
});

Also please tell me how to access this data. Should I access it like data.data and data.count?

解决方案

Parse error on line 121:
...    },    "date": MonMay0612: 19: 48IS
---------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['

http://jsonlint.com/

You need to put your date like this -

"date": "MonMay0612: 19: 48IST2013"