程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> json-extjs 報錯Youre trying to decode and invalid JSON

json-extjs 報錯Youre trying to decode and invalid JSON

編輯:編程綜合問答
extjs 報錯You're trying to decode and invalid JSON

IE報錯:You're trying to decode and invalid JSON String: {"ganttTask":{"baseline_end_date":null,"baseline_start_date":null,"duration":0.0,"duration_unit":null,"end_date":null,"id":4,"index":3,"name":"New Task","other_field":null,"parent_id":null,"percent_done":100,"pid":7,"priority":null,"start_date":null,"task_id":"JMPAR000007"},"ganttTaskList":[{"baseline_end_date":null,"baseline_start_date":null,"duration":0.0,"duration_unit":null,"end_date":"2015-07-23","id":1,"index":1,"name":"New Task","other_field":","parent_id":null,"percent_done":100,"pid":7,"priority":null,"start_date":"2015-07-02","task_id":"JMPAR000007"},{"baseline_end_date":null,"baseline_start_date":null,"duration":0.0,"duration_unit":null,"end_date":null,"id":2,"index":4,"name":"New Task","other_field":null,"parent_id":null,"percent_done":0,"pid":7,"priority":null,"start_date":null,"task_id":"JMPAR000007"},{"baseline_end_date":null,"baseline_start_date":null,"duration":0.0,"duration_unit":null,"end_date":"2015-07-29","id":3,"index":2,"name":"New Task","other_field":null,"parent_id":null,"percent_done":0,"pid":7,"priority":null,"start_date":"2015-07-01","task_id":"JMPAR000007"},{"baseline_end_date":null,"baseline_start_date":null,"duration":0.0,"duration_unit":null,"end_date":null,"id":4,"index":3,"name":"New Task","other_field":null,"parent_id":null,"percent_done":100,"pid":7,"priority":null,"start_date":null,"task_id":"JMPAR000007"}],"signTask":null,"success":true,"taskCount":0,"taskList":null,"task_id":"JMPAR000007"}

如果date裡有日期它就不報錯。為什麼?

 Ext.define('GanttTask', {
            extend: 'Ext.data.Model',
            fields: [
                   {name: 'task_id',       type: 'string'},
                   {name: 'name',       type: 'string'},
                   {name: 'percent_done',       type: 'int'},
                   {name: 'start_date',       type: 'string'},
                   {name: 'end_date',       type: 'string'},
                   {name: 'other_field',       type: 'string'},
                   {name: 'duration',       type: 'string'},
                   {name: 'pid',       type: 'int'},
                   {name: 'index',       type: 'int'}
                ]
        });

     var adstore = Ext.create('Ext.data.Store', {
            remoteSort: true,
            //設置分頁大小  
            remoteFilter : true,     
            model: 'GanttTask',
            proxy: {             
                type: 'ajax',
                url: 'taskList_query.action?task_id='+task_id, 
                reader: {
                    type: 'json',
                    root: 'ganttTaskList',
                        //獲取數據總數  
                    totalProperty: 'totalCount'
                }
           },
            autoLoad: false
        }

        );

最佳回答:


 "name":"New Task","other_field":","parent_id":null,
 看看"other_field":",",這個json格式不對了
 可以上在線網站校驗
 http://www.bejson.com/
y393791327
danielinbiti
y393791327
danielinbiti
y393791327
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved