0

Folks, 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",
                "Score"],
                "ColumnTypes": ["String",
                "Double"],
                "Values": [["negative",
                "0.20"],
                **["negative",
                "0.03"]**]
            }
        }
    }
}

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]");
BWA
  • 5,672
  • 7
  • 34
  • 45
Sudheej
  • 1,873
  • 6
  • 30
  • 57

1 Answers1

2

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

string valv = (string)o.SelectToken("$.Results.output1.value.Values[0][1]");
stefankmitph
  • 3,236
  • 2
  • 18
  • 22