Creating List<dynamic> using Dynamic variable in C#

Viewed 10

JSON Output

{ 
    "balance":100.0,
    "trc10": [{
        "TR7NHqjeK": "10000000",
     "KQxGTCi8": "20000000"
    }],
    "trc20": [{
        "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t": "10000000",
     "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjL56": "40000000"
    }] 
}

public class Root
    {
        public double balance { get; set; }
        public List<dynamic> trc10 { get; set; }
        public List<dynamic> trc20 { get; set; }
    }

The code to transform the JSON would look something like this: c# code

Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse); 
Response.Write((myDeserializedClass.balance).ToString());

myDeserializedClass.balance output - 100.0

how to gat value of trc10,trc20 List item with select and where query like myDeserializedClass.trc20.Where(x => x.TR7NHqjeKQxGTCi8q8ZY4pL8otSsssj6t == "TR7NHqjeKQxGTCi8q8ZY4pL8otSsssj6t")

0 Answers
Related