Afternoon Everyone,
I have not been coding for a very long time and a little rusty and been asked to knock up a little export utility that gets data from an API applies some various filters then exports to excel. I can grab the data from the API and I can export to excel easily but what I need to be able to do is deserialize from JSON into a list (of CustomClass) which is where I am drawing a blank. I have tried to research online and I am either not finding what I need or I am to dumb to understand (latter very probable).
The difficulty is that there is a collection of items within the collection in the json.
Here is my class for holding the data:
Here is a sample of the JSON that I get:
Any help is much appreciated!
I have not been coding for a very long time and a little rusty and been asked to knock up a little export utility that gets data from an API applies some various filters then exports to excel. I can grab the data from the API and I can export to excel easily but what I need to be able to do is deserialize from JSON into a list (of CustomClass) which is where I am drawing a blank. I have tried to research online and I am either not finding what I need or I am to dumb to understand (latter very probable).
The difficulty is that there is a collection of items within the collection in the json.
Here is my class for holding the data:
Code:
Public Class Ticket
Public dt As DateTime
Public summary As String
Public issuetype As String
Public team As String
Public priority As Integer
Public path As String
Public caller As String
Public CIPFA_priority As String
Public person As String
Public details As String
Public messages As New List(Of message)
End Class
Public Class message
Public from As String
Public recip As String
Public body As String
Public DT As DateTime
Public id As String
End Class
Code:
{
"records": {
"record": [{
"date": "Mon Jun 04 2018 16:31:18 GMT+0100 (BST)",
"summary": "Passenger lift",
"issuetype": "contractor",
"team": "unassigned",
"priority": "3",
"path": "Ground Floor: Ext. Lift",
"caller": "Staff Name Removed",
"CIPFA_priority": "",
"person": "Staff Name Removed",
"details": "Please carry out investigate of Lift not working.",
"allmessages": {
"messages": {
"message": {
"msgSubject": "New Helpdesk issue (contractor) (H-ID:000000-C00000-T000000): Ground Floor: Ext. Lift: 'lift '",
"msgTo": "Staff Name Removed",
"msgFrom": "Staff Name Removed",
"msgBody": "You have a new Helpdesk issue (contractor): Ground Floor: Lift: 'lift '\n\nHelpdesk issue (contractor) details:\nPlease carry out investigate of Lift not working.\n\nNOTE: either sender and recipient were the same or an attempt to also send this message by email and/or SMS on (Mon Jun 04 2018 16:31:30 GMT+0100 (BST)) was NOT successful. Please check relevant email/phone number details!",
"msgDate": "Mon Jun 04 2018 16:31:20 GMT+0100 (BST)"
}
}
},
"id": "00000",
"status": "in progress"
} ]
}
}