I am working on the attached jSon response. I need to read the sub-array named "details" and populate a datagrid.
I am using VB.NET.
Attached is how I declared the classes to be used in my LINQ query.
Below is my code so far.
Dim docs = JArray.FromObject(parsedOb
ject("invo
ice")).Sel
ect(Functi
on(x) x.ToObject(Of MyClass.InvoiceList)())
'Dim invoiceL = docs.Select(Function(x) x).OrderBy(Function(x) x.number).ToList
Dim InvoiceDetailL = docs.Select(Function(g) New With {g.details.First().totalBo
xes, g.details.First().descript
ion, g.details.First().store, g.details.First().productI
d, g.details.First().totalPri
ce, g.details.First().Type}).T
oList()
gdviewDetail.DataSource = InvoiceDetailL
gdviewDetail.DataBind()
As you can see, I am able to create "InvoiceDetailL" with only the first row of "details", as I used the function First(). How can I obtain all elements in the sequence?
Class_Declaration_EE.txt
jSon_Response_EE.txt
Open in new window
Now when deserialized into this class structure, we would use First to get the first InvoiceList item, then set the details to the datasource of the DataGridView; e.g. -Open in new window
Proof of concept -
Open in new window
Produces the following output -
-saige-