I am attempting to parse some json I am getting back from a service. For example it's returning
{
"error" :
{
"code" : 500,
"message" : "Error Executing Task. Error executing tool.",
"details" : []
}
}
All I need is the text in the message field. Using jayrock what is the easity way to get to the data. I have:
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim jarray As Jayrock.Json.JsonObject
request = DirectCast(WebRequest.Create(url), HttpWebRequest)
response = DirectCast(request.GetResponse(), HttpWebResponse)
Dim reader As JsonTextReader = New JsonTextReader((New StreamReader(response.GetResponseStream)))
jarray = Jayrock.Json.Conversion.JsonConvert.Import(reader)
what is the most efficant way of getting the "message" data
I can only speak for myself, but I'd write it this way:
P.S.: Don't forget to import Jayrock.Json and Jayrock.Json.Conversion