使用vb.net和newtonsoft在JSON文件中解析所有信息
试图弄清楚如何与vb.net一起使用newtonsoft。我正在解析各种信息,很想知道如何将所有信息分开。
这是我的代码:
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Public Module Module1
Public Sub Main()
Dim json As String = "{""name"":""Sam"",""age"":""23"",""scores"":[{""main"":12,""side"":40},{""main"":123,""side"":51}],""final"":{""test1"":0,""test2"":2}}"
Dim finalInfo = JsonConvert.DeserializeObject(Of information)(json)
Console.WriteLine(finalInfo.name)
Console.ReadKey()
End Sub
Public Class information
Public name As String
Public age As String
End Class
End Module
如您所见,我已经能够解析对象 name 和 age ,而不是数组得分和具有多个的对象值最终。
对此的任何帮助将不胜感激,谢谢!
Trying to figure out how to use Newtonsoft with VB.net. I'm parsing a variety of information and would love to know how to separate it all.
Here's my code:
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Public Module Module1
Public Sub Main()
Dim json As String = "{""name"":""Sam"",""age"":""23"",""scores"":[{""main"":12,""side"":40},{""main"":123,""side"":51}],""final"":{""test1"":0,""test2"":2}}"
Dim finalInfo = JsonConvert.DeserializeObject(Of information)(json)
Console.WriteLine(finalInfo.name)
Console.ReadKey()
End Sub
Public Class information
Public name As String
Public age As String
End Class
End Module
As you can see I'm already able to parse objects name and age but not the array scores and the object with multiple values final.
Any help with this would be deeply appreciated, thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要此类信息
you need this class information