Chris Jones
asked on
JSON parse help
hello,
I have JSON outputs but I can't seem to parse them eh string has over 100 records in it but it looks to be nested in the returned strings I needed to break the items up and save into a structure etc..
JSON
I have JSON outputs but I can't seem to parse them eh string has over 100 records in it but it looks to be nested in the returned strings I needed to break the items up and save into a structure etc..
JSON
{
"operation": {
"result": {
"status": "Success",
"message": "requests listed successfully"
},
"details": [{
"workorderid": "407250",
"requester": "Margo Mccutcheon",
"createdby": "System",
"createdtime": "1487609106660",
"duebytime": "-1",
"subject": "Graduate Research Assistant Project - Video editing software",
"technician": "",
"priority": "",
"status": "Open",
"isoverdue": "false",
"accountname": "TAMUC",
"ignorerequest": "false"
}, {
Should be (I think)
{
"operation": {
"result": {
"status": "Success",
"message": "requests listed successfully"
},
"details": [{
"workorderid": "407250",
"requester": "Margo Mccutcheon",
"createdby": "System",
"createdtime": "1487609106660",
"duebytime": "-1",
"subject": "Graduate Research Assistant Project - Video editing software",
"technician": "",
"priority": "",
"status": "Open",
"isoverdue": "false",
"accountname": "TAMUC",
"ignorerequest": "false"
}]
}
}
ASKER
yes sorry i just posted a small example of the data that i needed to break up i tested the entire string and its valid i just need a way to parse through it and get the data from each instance in my JSON. the example has about 1000+ records in it
ASKER
so how could I parse this from my string using .net
"details": [{
"workorderid": "407250",
"requester": "Margo Mccutcheon",
"createdby": "System",
"createdtime": "1487609106660",
"duebytime": "-1",
"subject": "Graduate Research Assistant Project - Video editing software",
"technician": "",
"priority": "",
"status": "Open",
"isoverdue": "false",
"accountname": "TAMUC",
"ignorerequest": "false"
}]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i have something similar and i was deserializing it
Dim result = JsonConvert.DeserializeObject(responseFromServer)
Dim o As JObject = JObject.Parse(responseFromServer)
Dim results As List(Of JToken) = o.Children().ToList
For Each item As JProperty In results
item.CreateReader()
If item.Value.Type = JTokenType.Array Then
For Each subitem As JObject In item.Values
If DebugMe = "T" Then
Console.Write("-----------------")
Console.WriteLine()
Console.Write(subitem("workorderid"))
Console.WriteLine()
Console.Write("-----------------")
End If
Next
End If
Next
ASKER
Thanks this worked great
Glad we could help.
@OP, experts and future visitors:
Please remember to endorse my, or any other expert's comments that you found helpful by clicking on the "Thumb's Up" button
Read more on endorsements
https://www.experts-exchange.com/discussions/218503/What-are-Endorsements.html
@OP, experts and future visitors:
Please remember to endorse my, or any other expert's comments that you found helpful by clicking on the "Thumb's Up" button
Read more on endorsements
https://www.experts-exchange.com/discussions/218503/What-are-Endorsements.html
Tested here http://jsonlint.com