I get a json response after making a query to an api.
The JSON is like:
{
\"results\": [
{
\"alternatives\": [
{
You could parse the JSON into concrete classes and work with those hereafter.
To do so, you could use a service like json2csharp which generates classes based on the JSON you provided. Alternatively, you could use the Visual Studio built-in feature Paste JSON As Classes:
public class Alternative
{
public double confidence { get; set; }
public string transcript { get; set; }
}
public class Result
{
public List alternatives { get; set; }
public bool final { get; set; }
}
public class RootObject
{
public List results { get; set; }
public int result_index { get; set; }
}
You can then use JSON.NET to parse the stringified JSON to concrete class instances:
var root = JsonConvert.DeserializeObject(responseFromServer);