我有一个问题,我怎么能在VB.NEt中序列化这个字符串? 它看起来很简单,但我不能这样做,字符串是
{
“RedeemItems”:[{ “RedeemCode”: “XXXXX”},{ “RedeemCode”: “XXXXXXXX”},{ “AssetKey”: “xxxxxxxxxxxxxxxxxxxxxxxxx”}] }
我的代码是:
Module Module1
Sub Main()
Try
Dim a As New RedItems
a.RedeemItems.Add(New RedeemCodes With {.RedeemCode = "11"})
a.RedeemItems.Add(New RedeemCodes With {.RedeemCode = "22"})
result = JsonConvert.SerializeObject(a)
End Sub
Public Class RedItems
Public Property RedeemItems As List(Of RedeemCodes) = New List(Of RedeemCodes)()
End Class
Public Class RedeemCodes
Public Property RedeemCode() As String
End Class
但是我知道如何添加标签:“AssetKey”,如果我把标签放在“RedeemCodes”类中,JSon的链条不起作用,请帮我。感谢