I've gotten pretty far but ran into wall with this. Have JSON coming from a web API I am using.
Here is the Json string (or at least the first part)
{
"id": "065f1b17-0b2c-47c1-9674-c2bfda8c05bc",
"number": "167",
"title": "SSF-5003 MC Checklist HVAC",
"status": "open",
"description": null,
"shared": false,
"items":
[
{
"id": "a31a2f92-e948-4563-809e-6faed67e5db3",
"description": "Project Number",
"type": "text-area",
"comment": null,
"issue": null,
"response": {
"value": "Az001",
"responded_by": {
"id": "1208055465",
"organization": {
"id": "1207960635",
"name": "xxxxxxxxx",
"trading_name": "xxxx"
},
"first_name": "Brett",
"last_name": "VanDyke"
},
"responded_at": "2017-03-02T14:45:47.924Z"
},
"item_number": "1",
"photo_url": null,
"response_options": [ ]
},
My two classes:
Public Class HVAC
Public Property id As String
Public Property number As Int64
Public Property title As String
Public Property status As String
Public Property description As String
Public Property items As hvac_item()
End Class
Public Class hvac_item
Public Property id As String
Public Property description As String
Public Property type As String
Public Property item_number As Int32
Public Property response As Dictionary(Of String, String)
End Class
Main code deserliazing the json:
json_in = File.ReadAllText(Path.GetTempPath() & "\hvac.json")
Dim hvac = JsonConvert.DeserializeObject(Of HVAC)(json_in)
If I comment out the "response" property I deserialize without any errors and see all info (except in the "response" section).
Cannot figure out how to get the dictionary information out. Think I might have to deserialize that within the hvac_item class but not sure.
Any help would be greatly appreciated.
"responded_by":is more than just a string. Where did the classes come from? VS will build (mostly correct) ones for you