110,533
社区成员
发帖
与我相关
我的任务
分享
{
"user_idcard_suspicion": {
"idcard_with_other_names": [],
"idcard_with_other_phones": [],
"idcard_applied_in_orgs": []
}
}
{
"user_idcard_suspicion": {
"idcard_with_other_names": [
{
"susp_name": "吴小汉",
"susp_updt": "2015-11-09 19:25:04"
}
],
"idcard_with_other_phones": [
{
"susp_phone_province": "江苏",
"susp_phone_operator": "中国移动",
"susp_updt": "2015-11-02 10:31:39",
"susp_phone": "13773215030",
"susp_phone_city": "苏州"
}
],
"idcard_applied_in_orgs": [
{
"susp_org_type": "线上信用卡代还",
"susp_updt": "2015-10-23 16:31:00"
}
]
}
}
public HonpotUserIdcardSuspicion user_idcard_suspicion { get; set; }
public class HonpotUserIdcardSuspicion
{
/// <summary>
/// 用这个身份证号码绑定的其他姓名
/// </summary>
public List<HonpotIdcardWithOtherNames> idcard_with_other_names { get; set; }
/// <summary>
/// 用这个身份证绑定的其他手机号码
/// </summary>
public List<HonpotIdcardWithOtherPhones> idcard_with_other_phones { get; set; }
/// <summary>
/// 身份证在那些类型的机构中使用过
/// </summary>
public List<HonpotIdcardAppliedInOrgs> idcard_applied_in_orgs { get; set; }
}
if(idcard_with_other_names!=null &&idcard_with_other_names.length>0)
即可。 public class MyJsonSerializerSettings
{
private MyJsonSerializerSettings() { }
/// <summary>
/// <para>json序列化的设置1</para>
/// <para>DateFormatHandling.IsoDateFormat: writes dates in the ISO 8601 format, e.g. "2012-03-21T05:40Z".</para>
/// <para>MissingMemberHandling:</para>
/// <para>NullValueHandling:空值则忽略,不做json序列化</para>
/// </summary>
public static JsonSerializerSettings serSettings1
{
get
{
return new JsonSerializerSettings
{
//DateFormatHandling = DateFormatHandling.IsoDateFormat,
MissingMemberHandling = MissingMemberHandling.Ignore,
ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Include,
//ObjectCreationHandling = ObjectCreationHandling.Auto,
TypeNameHandling = TypeNameHandling.Auto
};
}
}
}
这个
"idcard_with_other_names": [
{
"susp_name": "吴小汉",
"susp_updt": "2015-11-09 19:25:04"
}
]
定义肯定是MYTYPE [] idcard_with_other_names;
如果是"idcard_with_other_names": [],反序列化后,idcard_with_other_names.length=0.
如果是"idcard_with_other_names": null,反序列化后,idcard_with_other_names.length=null?
所以使用时,if(idcard_with_other_names.length!=null &&idcard_with_other_names.length.length>0)即可。 HoneypotSearch value = fastCSharp.emit.jsonParser.Parse<HoneypotSearch>(result);