# SOLVED: JSON error when Querying UnbondRequests from Anchor bLunaHub Contract

**URL:** <https://classic-agora.terra.money/t/solved-json-error-when-querying-unbondrequests-from-anchor-blunahub-contract/4993>\
**Category:** Technical Development\
**Created:** [March 15, 2022, 4:57am UTC](https://classic-agora.terra.money/t/solved-json-error-when-querying-unbondrequests-from-anchor-blunahub-contract/4993 "2022-03-15T04:57:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aries](https://sea2.discourse-cdn.com/terra/user_avatar/classic-agora.terra.money/aries/32/2587_2.png) [@Aries](https://classic-agora.terra.money/u/Aries)\
**Post date:** [March 15, 2022, 4:57am UTC](https://classic-agora.terra.money/t/solved-json-error-when-querying-unbondrequests-from-anchor-blunahub-contract/4993/1 "2022-03-15T04:57:50Z")

</div>

Guys, I cant seem to figure out how to get a response from Anchor Protocol bAsset contract (bLuna Hub). This is the code that I am using.

```auto
pub fn query_unbond(deps: Deps, contract: Addr, useraddress: Addr) -> StdResult<UnbondResponse> {

    let query: UnbondRequestsResponse = deps.querier.query(&QueryRequest::Wasm(WasmQuery::Smart {
            contract_addr: contract.to_string(),
            msg: to_binary(&basset::hub::QueryMsg::UnbondRequests {
            address: useraddress.to_string(),
        })?,
    }))?;

    Ok(UnbondResponse { address: query.requests[0].1 })

    //tried with Ok(UnbondResponse { address: query.address }) to return the useraddress. But, this also gives the same JSON error.

}

```

I get the following error message.

```auto
rpc error: code = Unknown desc = Error parsing into type basset::hub::UnbondRequestsResponse: JSON has non-whitespace trailing characters after the value.: contract query failed

```

Anyone know how to solve this?

Thank you.

Regards,  
Aries

---

<div class="post-metadata">

**Author:** ![petes-fan-club](https://sea2.discourse-cdn.com/terra/user_avatar/classic-agora.terra.money/petes-fan-club/32/19959_2.png) [@petes-fan-club](https://classic-agora.terra.money/u/petes-fan-club)\
**Post date:** [March 15, 2022, 6:11am UTC](https://classic-agora.terra.money/t/solved-json-error-when-querying-unbondrequests-from-anchor-blunahub-contract/4993/2 "2022-03-15T06:11:20Z")

</div>

the query looks ok to me tbh.  
how do it look in testing?

maybe try returning the actually ‘query’? without messing with it?  
otherwise maybe a package version issue?

---

<div class="post-metadata">

**Author:** ![Aries](https://sea2.discourse-cdn.com/terra/user_avatar/classic-agora.terra.money/aries/32/2587_2.png) [@Aries](https://classic-agora.terra.money/u/Aries)\
**Post date:** [March 15, 2022, 6:34am UTC](https://classic-agora.terra.money/t/solved-json-error-when-querying-unbondrequests-from-anchor-blunahub-contract/4993/3 "2022-03-15T06:34:40Z")

</div>

Thank you for the reply.

Just wanted to let you know that I am trying to parse the following response which is got from the bLunaHub contract.

```auto
{
  "address": "<address>",
  "requests": [
    [
      1,
      "100",
      "0"
    ]
  ]
}

```

---

<div class="post-metadata">

**Author:** ![Aries](https://sea2.discourse-cdn.com/terra/user_avatar/classic-agora.terra.money/aries/32/2587_2.png) [@Aries](https://classic-agora.terra.money/u/Aries)\
**Post date:** [March 15, 2022, 12:39pm UTC](https://classic-agora.terra.money/t/solved-json-error-when-querying-unbondrequests-from-anchor-blunahub-contract/4993/4 "2022-03-15T12:39:53Z")

</div>

> [@Aries](#):
>
> ```auto
> rpc error: code = Unknown desc = Error parsing into type basset::hub::UnbondRequestsResponse: JSON has non-whitespace trailing characters after the value.: contract query failed
> 
> ```

@petes-fan-club Thank you. With your clue, I figured it out and got it working. Anchor’s github repo is not upto date. In the repo, I found this.

```auto
pub type UnbondRequest = Vec<(u64, Uint128)>;

```

In the above, only batch id and bLuna was included.

However, when I was searching for Anchor Docs, I found the updated code as below. Here, it contains batch id, bLuna and stLuna.

```auto
pub type UnbondRequest = Vec<(u64, Uint128, Uint128)>;

```

This was the issue. This is solved. Thank you.

Regards,  
Aries
