M
moondaddy
Guest
I'm able to get an element from some Json like this:
//response.Content came from a HTTP request
var values = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, object>>(response.Content);
and values["results"] is this:
"[{\"v_type\":\"PhoneCall\",\"attributes\":{\"eventDate\":{\"MAX\":0,\"MIN\":0,\"AVG\":0},\"callLength\":{\"MAX\":0,\"MIN\":0,\"AVG\":0}}}]"
I need to get a dictionary object for the element "attributes" from the Json above. How can I do this? Since that's a Json element I tried this again:
var newvalues2 = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, object>>(values["results"].ToString());
but I get an error message:
"The JSON value could not be converted to System.Collections.Generic.Dictionary`2[System.String,System.Object]"
How can I get a Dictionary object for the data under "attributes"?
Thank you
Continue reading...
//response.Content came from a HTTP request
var values = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, object>>(response.Content);
and values["results"] is this:
"[{\"v_type\":\"PhoneCall\",\"attributes\":{\"eventDate\":{\"MAX\":0,\"MIN\":0,\"AVG\":0},\"callLength\":{\"MAX\":0,\"MIN\":0,\"AVG\":0}}}]"
I need to get a dictionary object for the element "attributes" from the Json above. How can I do this? Since that's a Json element I tried this again:
var newvalues2 = System.Text.Json.JsonSerializer.Deserialize<Dictionary<string, object>>(values["results"].ToString());
but I get an error message:
"The JSON value could not be converted to System.Collections.Generic.Dictionary`2[System.String,System.Object]"
How can I get a Dictionary object for the data under "attributes"?
Thank you
Continue reading...