Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27425

VS 2019 Newtonsoft help

$
0
0
I'm trying to get a value from a json string using Newtonsoft, but I can't seem to figure this one out.

Here is the json string:

Code:

{
  "error_message": "",
  "success": true,
  "metadata": [
    {
      "id": "COUNT(*)",
      "key": "COUNT(*)",
      "name": "COUNT(*)",
      "type": "number",
      "data": null,
      "table_id": "",
      "table_name": "",
      "base_id": ""
    }
  ],
  "is_join_stmt": false,
  "results": [
    {
      "COUNT(*)": 9129
    }
  ]
}

I'm trying to get the value in the results>COUNT(*) node. (9129 in this case)

I have tried the following code, but this gives me an error:

Code:

Dim jsonObject As JObject = JObject.Parse(jsonString)
resultsNode = jsonObject("results")
Dim count As String = resultsNode(0).SelectToken("COUNT(*)").ToString

Any help would be appreciated. Thanks...

Viewing all articles
Browse latest Browse all 27425

Latest Images

Trending Articles



Latest Images