Q:

How to select an element's value from a JArray

I'm having a bit of trouble with C# (VS 2017, .Net 4.6) code.  It'd be great if someone could help.  I have a JSON file:
{
  "makerCommission": 10,
  "takerCommission": 10,
  "buyerCommission": 0,
  "updateTime": 1540015045989,
  "balances": [
    {
      "asset": "BTC",
      "free": "0.22222222",
      "locked": "0.00000000"
    },
    {
      "asset": "LTC",
      "free": "2.00000000",
      "locked": "3.00000000"
    },
    {
      "asset": "ETH",
      "free": "4.00000000",
      "locked": "5.00000000"
    }
  ]
}

I would like to retrieve the "free" value of any coin using:
result = (dynamic)JArray. Parse(MyData)

I do not want to retrieve all free values.  How can I get 0.22222222, if I pick BTC?  

A:

First of all, your overall JSON does not represent an array, it represents an object which contains an array.   So you would need to use JObject. Parse instead of JArray. Parse. 
You can use the following LINQ-to-JSON code to find a specific asset in the array and then get the free value from it:
JObject obj = JObject. Parse(json);               // Parse the JSON to a JObject

string free = obj["balances"]                    // Navigate down to the "balances" array
    .Where(jt => (string)jt["asset"] == "BTC")   // Find the object(s) containing the asset you want
    .Select(jt => (string)jt["free"])            // From those get the "free" value
    .FirstOrDefault();                           // Take the first of those

Fiddle: https://dotnetfiddle.net/uFjSib

