Adding nested array as value in JSON body

Hi. I am trying to nest an array of key-value pairs within the JSON body.

I can't see why nesting the array within the JSON body as a value isn't working. Similarly, when I tried the alternative of just using raw JSON, I can't see why I'm then getting internal server errors.

Any help on this would be hugely appreciated - TIA!

Here is my JSON body:

I get the following JSON error:

JSON Error

How the values are displayed within the state of the query:

I've also tried adding it as raw JSON as below.

Raw JSON Code

This also has not worked. It shows the following error in the response:

Raw JSON Error

It then shows the values [object object] when checking the state:

Hey Chris! A lot of the specifics are going to depend on your specific API and what it was developed to accept. In cases where I need a more flexible body configuration than what's available with the different types, I've manually constructed a raw body with JS in other cases to get a format the API expects.

Do you know what your API expects here?

Hi Victoria,

I did reply through email but thought I'd add it here too.

The API documentation from HSBC provided this as a JSON code example:



"accountBalances": [{

"accountNumber": "604014571151",

"accountCountry": "GB",

"accountType": "CA",

"institutionCode": "HBEU"



So, it should be expecting a nested array which I thought is what we have in my first screenshot.

I then tried that code in raw JSON and it then threw the 400 server error 😫



Hey Chris! So sorry for the delay here, it's been a hectic couple weeks.

Would it be alright if I stepped into your app to poke around with your query here? If so, let me know the name of your app and/or query! If not, happy to hop on a quick call together :slight_smile:

Hey Victoria,

Thanks for getting back.

Since posting, I've actually managed to resolve the issue, so sorry for the lack of update on my part.

It was nothing to do with the content of the code. As part of the authentication process for the sandbox, it asked for a profile ID. However, rather than our specific profile ID, given in the documentation, it wanted to be passed a generic profile ID associated to just the sandbox environment.


Oh, awesome! Very glad to hear you were able to resolve this and no apologies needed (I'm sorry again for the delay in getting back to you).

Thank you for the good news update :slight_smile: