I Have this kind of JSON file:
[{
"orderId": "36186",
"customerID": "584",
"OrderArticle": [
{
"productId": "1780",
"webCategory": "Cat1",
"articleQty": "1",
"perQty": ""
},
{
"productId": "2587",
"webCategory": "Cat3",
"articleQty": "58",
"perQty": ""
}
]
//..........
}]
and those Classes:
Public Class Response
Public Property show() As Orders
End Class
Public Class Orders
Public Property productID As String
Public Property orderDate As String
Public Property articles() As New List(Of Orderarticle)
End Class
Public Class Orderarticle
Public Property productId As String
Public Property webCategory As String
Public Property articleQty As String
Public Property perQty As String
End Class
OrderArticle may contain from 1 to x articles.
I'm trying with:
Dim json As String = My.Computer.FileSystem.ReadAllText(filePath)
Dim orderList = JsonConvert.DeserializeObject(Of List(Of Response))(json)
But I'm doing something wrong, I'm unable to iterate over articles list in each order. Yes, I've checked all Q/A related with this Issue, The problem is a null reference, not sure if a JSON format problem, a Newtonsoft problem or my fault.