HTTP Request not working with jason properly - array error

hello everyone, i am having a problem with the HTTP Request node, i am trying to use jason code that i took from apify in order to pass a leason i am still learning and for some reason i am doing everything correctly but it spit out an “array” error and asking me to check the parameters of the jason

note: i am not a programer so there are something i do not yet understand.

here is what is happening look at the photos:

PLEASE help me to solve this problem so that i can continute my learning, because i am also corrently out of a job and i want to start doing this and get paid only for these kind of works

one very important thing.. i am self hosting not a cloud

Hey @yedidya , the current structure you have provided in JSON is something like this:

[ { } ]

remove the brackets “ [ “ and “ ] “ present at the beginning and the end and it would fix the current error that is occurring.

Object is enclosed in this manner ‘{ }’. while array is enclosed in ‘[ ….. ]’.

Hi @yedidya Welcome!
Try using this

{{ [{ "title": "Jadu Cafe and Wine Bar", "url": "https://www.google.com/maps/place/Jadu+Cafe+and+Wine+Bar/@-33.0445,[email protected]%3A1.0f", "stars": 5, "name": "Ben Huey", "reviewURL": "https://www.google.com/site/reviews/data=14d8b114e71186d12a5116c1" }][0] }}

Great explanation about object vs array! :+1:

Just wanted to add one small clarification: Apify actors usually do expect arrays, so the original JSON structure isn’t actually wrong — it just can’t be sent as the top-level body in n8n.

In n8n, the HTTP Request node always expects the root to be an object, so the correct pattern is to wrap the array inside a field, like:

json

{
  "input": [
    {
      "title": "Jadu Cafe and Wine Bar",
      "url": "https://www.google.com/maps/..."
    }
  ]
}

The field name (input, items, etc.) depends on what the specific Apify actor expects.

So it’s not that arrays are wrong, they just need to be wrapped in an object when sending from n8n. Hope that helps clarify!

1 Like

i tried all you have said here, and it still does not work

basically i am trying top do a POST in the HTTP Request and it backing me to that error that the jason has an “array” and therefore i cannot move forward

this is the freaking jason that is giving me problems:

[

{

"title": "Jadu Cafe and Wine Bar",

"url": "https://www.google.com/maps/search/?api=1&query=Jadu%20Cafe%20and%20Wine%20Bar&query_place_id=ChIJwz-HHXR544kRVZwdPhIKCeM",

"stars": 5,

"name": "Ben Huey",

"reviewUrl": "https://www.google.com/maps/reviews/data=!4m8!14m7!1m6!2m5!1sCi9DQUlRQUNvZENodHljRjlvT2xVNU5EbDNOVnBKUmtZeFN6STRUekJDTjFkSWJWRRAB!2m1!1s0x0:0xe3090a123e1d9c55!3m1!1s2@1:CAIQACodChtycF9oOlU5NDl3NVpJRkYxSzI4TzBCN1dIbVE%7C0dUUyECx1Lq%7C?hl=en",

"text": "Had a really fun evening at Jadu. The staff was all very friendly and welcoming. The food was delicious with the highlight being the mortadella sandwich on focaccia. Will definitely be back"

},

{

"title": "Jadu Cafe and Wine Bar",

"url": "https://www.google.com/maps/search/?api=1&query=Jadu%20Cafe%20and%20Wine%20Bar&query_place_id=ChIJwz-HHXR544kRVZwdPhIKCeM",

"stars": 5,

"name": "Emma McGurren",

"reviewUrl": "https://www.google.com/maps/reviews/data=!4m8!14m7!1m6!2m5!1sCi9DQUlRQUNvZENodHljRjlvT2pVeWFuSlVkVzFRTUdGWmNYUlNZeTFCWWxKcFYxRRAB!2m1!1s0x0:0xe3090a123e1d9c55!3m1!1s2@1:CAIQACodChtycF9oOjUyanJUdW1QMGFZcXRSYy1BYlJpV1E%7C0dS26OQLcbY%7C?hl=en",

"text": null

},

{

"title": "Jadu Cafe and Wine Bar",

"url": "https://www.google.com/maps/search/?api=1&query=Jadu%20Cafe%20and%20Wine%20Bar&query_place_id=ChIJwz-HHXR544kRVZwdPhIKCeM",

"stars": 5,

"name": "Graham Turk",

"reviewUrl": "https://www.google.com/maps/reviews/data=!4m8!14m7!1m6!2m5!1sCi9DQUlRQUNvZENodHljRjlvT2tRemNUY3pha1JNUkRkeVZXbFVWV0pVV2pKV2NHYxAB!2m1!1s0x0:0xe3090a123e1d9c55!3m1!1s2@1:CAIQACodChtycF9oOkQzcTczakRMRDdyVWlUVWJUWjJWcGc%7C0dQHzIA9ROv%7C?hl=en",

"text": "Stopped into Jadu for a glass of wine last week after reading about their new-ish alcohol license in the Globe. The ambiance, wine selection, and staff were all fantastic. We're lucky to have a place like this in JP."

},

{

"title": "Jadu Cafe and Wine Bar",

"url": "https://www.google.com/maps/search/?api=1&query=Jadu%20Cafe%20and%20Wine%20Bar&query_place_id=ChIJwz-HHXR544kRVZwdPhIKCeM",

"stars": 5,

"name": "Lina",

"reviewUrl": "https://www.google.com/maps/reviews/data=!4m8!14m7!1m6!2m5!1sCi9DQUlRQUNvZENodHljRjlvT2pad1psQlhZekZPTVU1TGRuZzJUSE5MTW1aS1lVRRAB!2m1!1s0x0:0xe3090a123e1d9c55!3m1!1s2@1:CAIQACodChtycF9oOjZwZlBXYzFOMU5Ldng2THNLMmZKYUE%7C0dQ5pvZaFf2%7C?hl=en",

"text": "Delightful avocado toast and flavored lattes!!! One of my favorite cafes in boston"

},

{

"title": "Jadu Cafe and Wine Bar",

"url": "https://www.google.com/maps/search/?api=1&query=Jadu%20Cafe%20and%20Wine%20Bar&query_place_id=ChIJwz-HHXR544kRVZwdPhIKCeM",

"stars": 3,

"name": "GT",

"reviewUrl": "https://www.google.com/maps/reviews/data=!4m8!14m7!1m6!2m5!1sCi9DQUlRQUNvZENodHljRjlvT2xwQ1dVOWlUelJuTTNOc1RqSTBZbk0wYlVNdE1sRRAB!2m1!1s0x0:0xe3090a123e1d9c55!3m1!1s2@1:CAIQACodChtycF9oOlpCWU9iTzRnM3NsTjI0YnM0bUMtMlE%7C0dHKy0UOOcY%7C?hl=en",

"text": "High quality drinks and food, but service is incredibly slow. I waited 20 minutes for a  latte. I appreciate a chill atmosphere, but the staff loves to chat more than get orders out efficiently - I think there can be a better balance. Not the spot to run in and get a quick drink at the moment, which is unfortunate because they’re the only spot with hojicha!"

},

{

"title": "Jadu Cafe and Wine Bar",

"url": "https://www.google.com/maps/search/?api=1&query=Jadu%20Cafe%20and%20Wine%20Bar&query_place_id=ChIJwz-HHXR544kRVZwdPhIKCeM",

"stars": 5,

"name": "Linden Yee",

"reviewUrl": "https://www.google.com/maps/reviews/data=!4m8!14m7!1m6!2m5!1sCi9DQUlRQUNvZENodHljRjlvT2pOMlQyaEpXbWxmV25ocVZFaExWMlZFWDFkb09YYxAB!2m1!1s0x0:0xe3090a123e1d9c55!3m1!1s2@1:CAIQACodChtycF9oOjN2T2hJWmlfWnhqVEhLV2VEX1doOXc%7C0dGrex7FCgM%7C?hl=en",

"text": "Went here during coffee shop hours-- great coffee and snacks at decent prices for Boston. This would be a great place to telework!"

},

{

"title": "Jadu Cafe and Wine Bar",

"url": "https://www.google.com/maps/search/?api=1&query=Jadu%20Cafe%20and%20Wine%20Bar&query_place_id=ChIJwz-HHXR544kRVZwdPhIKCeM",

"stars": 5,

"name": "Tyler Cumella",

"reviewUrl": "https://www.google.com/maps/reviews/data=!4m8!14m7!1m6!2m5!1sCi9DQUlRQUNvZENodHljRjlvT2xCWmMwZENielpKWkRsamVYQkZXRzFrTlhad2FYYxAB!2m1!1s0x0:0xe3090a123e1d9c55!3m1!1s2@1:CAIQACodChtycF9oOlBZc0dCbzZJZDljeXBFWG1kNXZwaXc%7C0dD4LCeDYSS%7C?hl=en",

"text": "My husband and I have been to Jadu a few times for coffee, breakfast, and pastries, and have been delighted each time. We recently went for their dinner/wine service, though, and loved it even more! Our server was lovely and provided great recommendations. The food was delicious and the portions allowed us to try a bunch of menu items. The vibe was cozy. We're so glad to have a spot like this in JP."

},

{

"title": "Jadu Cafe and Wine Bar",

"url": "https://www.google.com/maps/search/?api=1&query=Jadu%20Cafe%20and%20Wine%20Bar&query_place_id=ChIJwz-HHXR544kRVZwdPhIKCeM",

"stars": 2,

"name": "Russell Eason",

"reviewUrl": "https://www.google.com/maps/reviews/data=!4m8!14m7!1m6!2m5!1sCi9DQUlRQUNvZENodHljRjlvT2xkTFR6aDVSMU5KZEhWTWJtaFpNR0ZrTVVJeU5tYxAB!2m1!1s0x0:0xe3090a123e1d9c55!3m1!1s2@1:CAIQACodChtycF9oOldLTzh5R1NJdHVMbmhZMGFkMUIyNmc%7C0dC54Nrdg8d%7C?hl=en",

"text": "Although a nice atmosphere, coffee had a very long wait time"

}

]

Hi @yedidya, welcome!

First, which Apify actor are you using?!

From your screenshots, I can guess it’s this one:

How to use it:

Go to the “Run actor synchronously and get dataset items” section, copy the link, and paste it into the HTTP Request node:

and for the JSON body, go to the Input tab, copy the example JSON, and paste it into the node.

here:

Please copy this and modify it according to your requirements:

1 Like

finaly thank you so much you don’t know what that means to me that finally i got the right help for this

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.