'How to parse Json with 2 different keys?
I'm trying to parse this API
that is basically an order book with "asks" and "bids".
How can I parse them splitting the asks from the bids?
for example the api start with asks property
So if Json is {"asks":[["0.00001555","3264400"],["0.00001556","3662200"],["0.00001573","3264400"]
I'm expecting an output like:
[asks]
Price- Quantity
0.00001555 - 3264400
0.00001556 - 3662200
0.00001573 - 3264400
ecc
and After there is "bids":[["0.00001325","300"],["0.00001313","100"],["0.00001312","1051400"],["0.00001311","1300000"],["0.0000131","9336700"]
so I'm expecting
[bids]
Price- Quantity
0.00001325- 300
0.00001313 - 100
0.00001312 - 1051400
0.00001311 - 1300000
0.0000131 - 9336700
ecc
I know how to parse each single value with the code:
Dim streamData As Stream = Nothing
Using http As HttpClient = New HttpClient
Dim url As String = "https://api.hotbit.io/api/v1/order.depth?market=KIBA/USDT&limit=100&interval=1e-8"
Dim t As Task(Of Stream) = http.GetStreamAsync(url)
streamData = t.Result
End Using
Dim jsonResponse As JsonNode = JsonNode.Parse(streamData)
Dim result As JsonObject = jsonResponse("result").AsObject
For Each kvp In result.AsEnumerable
c &= kvp.Value("key?!?!?!?").ToString & ", "
Next
but in this case there is no Key that I can "parse" and also the values are in the format ["Price", "Quantity"] and also I don't know how to split the results between asks and bids maybe splitting them in two different richtextboxes multiline.. Any help would be appreciated Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
