xtechkid xtechkid - 1 year ago 101
JSON Question

Reading JSON Object Value in C# code

I am trying to access a json value from Azure ML rest service but i get a null value all the time, i tried different options but it did not work. Can u please provide ideas.

Json String

"Results": {
"output1": {
"type": "table",
"value": {
"ColumnNames": ["Sentiment",
"ColumnTypes": ["String",
"Values": [["negative",

Trying to fetch the value between **

Tried the below.

using Newtonsoft.Json.Linq;
JObject o = JObject.Parse(sentimentvalue);
string valv = (string)o.SelectToken("Results[0].output1[0].Values[0]");

Answer Source

Your JSON path in the SelectToken seems to be wrong. Try this:

string valv = (string)o.SelectToken("$.Results.output1.value.Values[0][1]");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download