相关疑难解决方法(0)

反序列化空值JSON.net时抛出的null值异常

嗨朋友我试图将隐藏的控制字段反序列化为JSON对象,代码如下:

Dim settings As New Newtonsoft.Json.JsonSerializerSettings() 
settings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore
Return Newtonsoft.Json.JsonConvert.DeserializeObject(Of testContract)(txtHidden.Text, settings) 
Run Code Online (Sandbox Code Playgroud)

但我得到以下例外.value cannot be null parameter name s:我甚至添加了以下行,但它仍然无法解决.请帮忙.

settings.MissingMemberHandling = Newtonsoft.Json.MissingMemberHandling.Ignore
settings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore 
settings.ObjectCreationHandling = Newtonsoft.Json.ObjectCreationHandling.Replace 
Run Code Online (Sandbox Code Playgroud)

.net json json.net

2
推荐指数
1
解决办法
7889
查看次数

标签 统计

.net ×1

json ×1

json.net ×1