Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JSON-转换为VB.NET对象_Json_Vb.net_Json Deserialization - Fatal编程技术网

JSON-转换为VB.NET对象

JSON-转换为VB.NET对象,json,vb.net,json-deserialization,Json,Vb.net,Json Deserialization,我不熟悉JSON字符串,所以我很难使用它。 我习惯于SOAP Web服务,在Visual Studio中,这些服务在后台自动为我创建强类型类 JSON-RESTWeb服务对我来说非常乏味,因为我必须手动创建等效的强类型类。(或者我可能错了) REST Web服务将此JSON字符串返回给我: {“Message”:“请求无效”。,“ModelState”:{“command”:[“在JSON.Path'、第1行、位置310中找不到必需的属性“Vendor”。],“command.Terms”:[“

我不熟悉JSON字符串,所以我很难使用它。 我习惯于SOAP Web服务,在Visual Studio中,这些服务在后台自动为我创建强类型类

JSON-RESTWeb服务对我来说非常乏味,因为我必须手动创建等效的强类型类。(或者我可能错了)

REST Web服务将此JSON字符串返回给我:

{“Message”:“请求无效”。,“ModelState”:{“command”:[“在JSON.Path'、第1行、位置310中找不到必需的属性“Vendor”。],“command.Terms”:[“Terms字段是必需的”。]}

你能给我介绍一下同等的课程吗

谢谢你的帮助

问候,,
Jake

假设您使用的是JSON.NET

Public Class Response
    Public Property Message As String
    Public Property ModelState As ModelState
End Class

Public Class ModelState
    <JsonProperty("command")>
    Public Property Command As List(Of String) = New List(Of String)

    <JsonProperty("command.Terms")>
    Public Property Terms As List(Of String) = New List(Of String)
End Class

谢谢你,山姆!它完全反序列化了。
Dim response As Response = JsonConvert.DeserializeObject(jsonString)