0
{
    "status": "success",
    "data": {
        "custid1": 723,
        "custid2": 670,
        "custid3": 430
    }
}

It doesn't have key-value pair it just contains the value of two columns. I have tried it by converting it into a data table but not getting the required result.

Vivek Nuna
  • 25,472
  • 25
  • 109
  • 197

2 Answers2

1

You can create a class like below. and then use NewtonSoft to deserialize it to the class object.

public class Data
{
    public int custid1 { get; set; }
    public int custid2 { get; set; }
    public int custid3 { get; set; }
}

public class Example
{
    public string status { get; set; }
    public Data data { get; set; }
}

Code to deserialize:

string json = <yourjson>;

Example ex = JsonConvert.DeserializeObject<Example>(json);

You can see the nugget package details here.

Vivek Nuna
  • 25,472
  • 25
  • 109
  • 197
0

You can deserialize it to ExpandoObject

ExpandoObject object1 =  JsonConvert.DeserializeObject<ExpandoObject>(json);
Berkay Yaylacı
  • 4,383
  • 2
  • 20
  • 37