json,将值{null}转换为类型'System.DateTime'时出错

时间:2017-01-23 12:43:46

标签: c# json datetime nullable

当我尝试在Json中输入以下DateTime参数时,抛出了这个JsonSerialization:

string json = e.ExtraParams["Values"];
Dictionary<string, object>[] mats = JSON.Deserialize<Dictionary<string, object>[]>(json);
Newtonsoft.Json.JsonSerializerSettings settings = new Newtonsoft.Json.JsonSerializerSettings 
{ 
    TypeNameHandling = Newtonsoft.Json.TypeNameHandling.Objects };
    ConcreteMat[] matList = JSON.Deserialize<ConcreteMat[]>(json, settings);
}

我试过Datetime?可空的它没有用,我也不想使用Nullable作为我的DateTime。感谢您的关注

我的ConcreteMat中的相关区域; ConcreteMat;

DateTime processDate;

[DataMember(IsRequired = true)]
public DateTime ProcessDate
{
    get { return processDate; }
    set { processDate = value; }
}

  <DirectEvents>
        <Select OnEvent="ShowMatInfo">
              <ExtraParams>
                    <ext:Parameter Name="Values" Value="Ext.encode(#{grdMatList}.getRowsValues({selectedOnly:true}))"                                  Mode="Raw" />
                </ExtraParams>
         </Select>
  </DirectEvents>

0 个答案:

没有答案