symilawr
(Lawrence Symington)
1
Given the JObject balances, how can I select balance where asset = ‘XBT’?
I am trying to return the value ‘2.2547’.
{
'balances':
[
{
'account_id': '123456789',
'asset': 'XBT',
'balance': '2.2547',
'reserved': '0.00',
'unconfirmed': '0'
},
{
'account_id': '9123456789',
'asset': 'USD',
'balance': '200.25',
'reserved': '0.00',
'unconfirmed': '0'
}
]
}
Thanks in advance
symilawr
ppr
(Peter Preuss)
2
myJObject is the output of the deserialize JSON Activity
As the balance is a JArray we can access the element (JObject) by index:

For filtering to the corresponding JObject Item we can do:
Assign Activity:
myXBTJO | DataType: JObject =
myJObject(“balances”).Where(Function (x) x(“asset”).Value(Of String).Equals(“XBT”)).FirstOrDefault
Then evaluate if myJObject is null or not an retrieve the balance
An optimistic Approach could be:
And will return below, when item is not present
system
(system)
Closed
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.