Skip to content

Cannot condition check and return both parent value as well as child (nested array) values #19

Description

@b-ron-son

{
"code": 200,
"data": [
{
"currency": "usdt",
"assetType": 1,
"chains": [
{
"chain": "trc20usdt",
"displayName": "TRC20",
"baseChain": "TRX",
"baseChainProtocol": "TRC20",
"isDynamic": false,
"numOfConfirmations": 1,
"numOfFastConfirmations": 1,
"depositStatus": "allowed",
"minDepositAmt": "1",
"withdrawStatus": "allowed",
"minWithdrawAmt": "2",
"withdrawPrecision": 6,
"maxWithdrawAmt": "1000000.00000000",
"withdrawQuotaPerDay": "1000000.00000000",
"withdrawQuotaPerYear": null,
"withdrawQuotaTotal": null,
"withdrawFeeType": "fixed",
"transactFeeWithdraw": "0.00000000",
"addrWithTag": false,
"addrDepositTag": false
},
{
"chain": "usdt",
"displayName": "OMNI",
"baseChain": "BTC",
"baseChainProtocol": "OMNI",
"isDynamic": false,
"numOfConfirmations": 2,
"numOfFastConfirmations": 1,
"depositStatus": "allowed",
"minDepositAmt": "20",
"withdrawStatus": "allowed",
"minWithdrawAmt": "200",
"withdrawPrecision": 8,
"maxWithdrawAmt": "600000.00000000",
"withdrawQuotaPerDay": "600000.00000000",
"withdrawQuotaPerYear": null,
"withdrawQuotaTotal": null,
"withdrawFeeType": "fixed",
"transactFeeWithdraw": "5.00000000",
"addrWithTag": false,
"addrDepositTag": false
},
{
"chain": "usdterc20",
"displayName": "ERC20",
"baseChain": "ETH",
"baseChainProtocol": "ERC20",
"isDynamic": false,
"numOfConfirmations": 12,
"numOfFastConfirmations": 12,
"depositStatus": "allowed",
"minDepositAmt": "1",
"withdrawStatus": "allowed",
"minWithdrawAmt": "10",
"withdrawPrecision": 6,
"maxWithdrawAmt": "1000000.00000000",
"withdrawQuotaPerDay": "1000000.00000000",
"withdrawQuotaPerYear": null,
"withdrawQuotaTotal": null,
"withdrawFeeType": "fixed",
"transactFeeWithdraw": "3.00000000",
"addrWithTag": false,
"addrDepositTag": false
}
],
"instStatus": "normal"
},
{
"currency": "husd",
"assetType": 1,
"chains": [
{
"chain": "husd",
"displayName": "HUSD",
"baseChain": "ETH",
"baseChainProtocol": "ERC20",
"isDynamic": false,
"numOfConfirmations": 12,
"numOfFastConfirmations": 12,
"depositStatus": "allowed",
"minDepositAmt": "1",
"withdrawStatus": "allowed",
"minWithdrawAmt": "2",
"withdrawPrecision": 8,
"maxWithdrawAmt": "1000000.00000000",
"withdrawQuotaPerDay": "1000000.00000000",
"withdrawQuotaPerYear": null,
"withdrawQuotaTotal": null,
"withdrawFeeType": "fixed",
"transactFeeWithdraw": "1.00000000",
"addrWithTag": false,
"addrDepositTag": false
}
],
"instStatus": "normal"
},

Hi there, I am trying to retrieve the following based on satisfying all the following conditions:
Condition 1 - "chain" is not empty
Condition 2 - "instStatus is "normal"
Condition 3 - "depositStatus is not "prohibited

Return the following:

  • currency
  • depositStatus

URL endpoint - https://api.huobi.pro/v2/reference/currencies

I manage to return "currency" based the Condition 1 and Condition 2.

=IMPORTJSONAPI("https://api.huobi.pro/v2/reference/currencies","$.data[?(@.chains!='' && @.instStatus=='normal')]","currency")

However, when I tried adding Condition 3, it doesn't seem to do anything (I get the same result)
=IMPORTJSONAPI("https://api.huobi.pro/v2/reference/currencies","$.data[?(@.chains!='' && @.instStatus=='normal' && @.chains.depositStatus!='prohibited')]","currency")

Also, can't seem to get "depositStatus" value back either.
PLEASE HELP

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions