嗨我有这个json字符串
[ { "desc" : "Unlike other foxes that roamed the woods of southern Ionia, Ahri had always felt a strange connection to the magical world around her; a connection that was somehow incomplete. Deep inside, she felt the skin she had been born into was an ill fit for her and dreamt of one day...",
"id" : 103,
"name" : "Ahri",
"tags" : [ "assassin",
"mage",
"ranged"
]
},
{ "desc" : "There exists an ancient order originating in the Ionian Isles dedicated to the preservation of balance. Order, chaos, light, darkness -- all things must exist in perfect harmony for such is the way of the universe. This order is known as the Kinkou and it employs a triumvirate...",
"id" : 84,
"name" : "Akali",
"tags" : [ "assassin",
"melee",
"stealth"
]
},
{ "desc" : "As the mightiest warrior to ever emerge from the Minotaur tribes of the Great Barrier, Alistar defended his tribe from Valoran's many dangers; that is, until the coming of the Noxian army. Alistar was lured from his village by the machinations of Keiran Darkwill, General Boram...",
"id" : 12,
"name" : "Alistar",
"tags" : [ "tank",
"pusher",
"melee"
]
}
我想从id属性中获取name属性 就像我想将id 103转换为冠军而最终结果将会给我" Ahri" 到目前为止这是我的代码
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim json As JsonConverter
Dim ent As champion = TryCast(JsonConvert.DeserializeObject(Of champion)(json), champion)
MsgBox(ent.name)
End Sub
End Class
Public Class champion
Public Property desc As String
Public Property id As Integer
Public Property name As String
Public Property tags As List(Of tags)
End Class
Public Class tags
Public Property type As Array
但它得到了这个错误
类型' Newtonsoft.Json.JsonSerializationException的未处理异常'发生在Newtonsoft.Json.dll
附加信息:无法将当前JSON数组(例如[1,2,3])反序列化为类型' json_test.champion'因为该类型需要一个JSON对象(例如{" name":" value"})才能正确反序列化。