我从iContact获取帐户信息,无法反序列化到班级。
请帮助反序列化以下数据流:
"{""accounts"":[{""billingStreet"":""3800 Mylanta Drive, 6th Floor"",""billingCity"":""Orlando"",""billingState"":""FL"",""billingPostalCode"":""32789"",""billingCountry"":""United States"",""city"":""Orlando"",""accountId"":""33323"",""companyName"":""My Company"",""country"":""United States"",""email"":""myemail@email.com"",""enabled"":""1"",""fax"":"""",""firstName"":""U.S."",""lastName"":""One & Two"",""multiClientFolder"":""1"",""multiUser"":""1"",""phone"":""(999) 999-9999"",""postalCode"":""32789"",""state"":""FL"",""street"":""3800 Mylanta Drive, 6th Floor"",""title"":""Marketing "",""accountType"":""0"",""subscriberLimit"":""250000""}],""total"":1,""limit"":20,""offset"":0}"
我正在使用以下课程
Public Class contactJSONClass
Public accounts As Account
End Class
Public Class ContactClass
Public AppId As String
Public BaseUrl As String
Public Username As String
Public Password As String
Public AccountId As String
Public ClientFolderId As String
Public TestMode As Boolean
End Class
Public Class AccountIDClass
Public AccountID As String
End Class
Public Class Account
Public billingCity As String
Public billingCountry As String
Public billingState As String
Public billingStreet As String
Public billingPostalCode As String
Public city As String
Public accountId As String
Public companyName As String
Public country As String
Public email As String
Public enabled As String
Public fax As String
Public firstName As String
Public lastName As String
Public multiClientFolder As String
Public multiUser As String
Public phone As String
Public postalCode As String
Public state As String
Public street As String
Public title As String
Public accountType As String
Public subscriberLimit As String
End Class
反序列化的代码是:
' API route
Dim apiRoute As String = My.Settings.Base_URL & "a/"
Dim response As HttpResponseMessage = Await client.GetAsync(apiRoute)
response.EnsureSuccessStatusCode()
responseBody = Await response.Content.ReadAsStringAsync()
'Parse JSON
model = JsonConvert.DeserializeObject(Of List(Of contactJSONClass))(responseBody)
这是从VS Studio再次粘贴在纯文本中的字符串 其中responseBody是变量名,最后的字符串是数据类型
responseBody "{""accounts"":[{""billingStreet"":""3800 Mylanta Drive, 6th Floor"",""billingCity"":""Orlando"",""billingState"":""FL"",""billingPostalCode"":""32789"",""billingCountry"":""United States"",""city"":""Orlando"",""accountId"":""33323"",""companyName"":""My Company"",""country"":""United States"",""email"":""myemail@email.com"",""enabled"":""1"",""fax"":"""",""firstName"":""U.S."",""lastName"":""One & Two"",""multiClientFolder"":""1"",""multiUser"":""1"",""phone"":""(999) 999-9999"",""postalCode"":""32789"",""state"":""FL"",""street"":""3800 Mylanta Drive, 6th Floor"",""title"":""Marketing "",""accountType"":""0"",""subscriberLimit"":""250000""}],""total"":1,""limit"":20,""offset"":0}" String