parsing one item from a JsonItem (KeyNotFoundException)

Here is my Json data in an easy to read format

I used notepad++ JSON Viewer plugin to ensure my string was proper. Here it is in string form:

{"success":true,"message":"","result":{"Currency":"BTC","Balance":0.00000006,"Available":0.00000006,"Pending":0.00000000,"CryptoAddress":"14Focssrf2SMejgy9XCJBrHeXPDb9Wkenj","Requested":false,"Uuid":null}}

I think so far my problem is I just don’t understand the relationships… the DOCS only show creating your own Jsonitem, not parsing one. Which I thought would have been enough to understand… but I just want… (in this case) to take the “Available” item… and update a label with it… from a timer, thats constantly getting the data from the web. I get KeyNotFoundException no matter what I have tried. Here is my failing code:

dim balance as string = signedApiCall("https://bittrex.com/api/v1.1/account/getbalance?apikey=", "¤cy=BTC") dim jsonBalance as new JSONItem(balance) availableBalanceLabel.text = jsonBalance.child("Available").ToString

This is giving me a KeyNotFoundException…

For my own code, I just grabbed the value of the second object and stored that in a new JSON Item and just worked with the .Value methods instead of the .Child

dim balance as string = signedApiCall("https://bittrex.com/api/v1.1/account/getbalance?apikey=", "¤cy=BTC") dim jsonBalance as new JSONItem(balance) if (jsonBalance.HasName("result")) then DIM jsonResult As JSONItem = jsonBalance.Value("result") if (jsonResult.HasName("Available")) then availableBalanceLabel.text = jsonResult.Value("Available").ToString end if end if

If the key you are seeking isn’t on the top level, you have to go through the tree to get it. In other words, first get the value of the “result” key, then from that get the value of the “Available” key (as in the code above).

I think this would work too, but give it a try as I have never used the .Child method (it returns a JSONItem)

availableBalanceLabel.Text = jsonBalance.Child("result").Value("Available").ToString

Yes that worked thank you so much !!!