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
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).