This is a migrated thread and some comments may be shown as answers.

JSON ommit field if the value is null

2 Answers 205 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Yaroslav
Top achievements
Rank 1
Yaroslav asked on 22 Dec 2011, 11:22 AM
Hi,
My json rest service omits fields when the values is null and looks like GRID can't handle such datasources.

Number is not null
{
{
    "id":"0422842A222780",
    "number":"0422842A222780"
  }
Number is null
{
    "id":"0422842A222780"
  }
model:{
    id:"id",
    fields:{
        id:{type:"string", editable:false},
        number:{type:"string", editable:false, nullable:true},
    }
}
As a result I see empty grid. When I remove this field from displaying all works fine Is there any solution?

2 Answers, 1 is accepted

Sort by
0
Claudio
Top achievements
Rank 1
answered on 18 Apr 2012, 09:36 AM
did you found your error?
it seems to be the last comma
wrong:
number:{type:"string", editable:false, nullable:true},
ok:
number:{type:"string", editable:false, nullable:true}


model:{
    id:"id",
    fields:{
        id:{type:"string", editable:false},
        number:{type:"string", editable:false, nullable:true},
    }
}
0
Yaroslav
Top achievements
Rank 1
answered on 18 Apr 2012, 09:46 AM
That's an error in sample, no error in real code and doesn't depend to real issue...sadly.
Tags
Data Source
Asked by
Yaroslav
Top achievements
Rank 1
Answers by
Claudio
Top achievements
Rank 1
Yaroslav
Top achievements
Rank 1
Share this question
or