A major error still not detected by the whole bubble community, 👎🏻

This is the error when we try to manipulate json coming from an API call.
If there is an array containing two further sub/child arrays each containing a different type of object, then the bubble only detects the first array type.
Here is an example of an issue, we are currently facing(realized at very the end of the project and waiting for it to be solved).

{
“body”: [
[
{
“id”: 4,
“group”: “size”,
“name”: “3.5 x 2”,
“hidden”: 0
}
],
[
{
“hash”: “004debf84bce770fef3002c600a66cce”,
“value”: “0.014966436518218718”,
“markup”: 0
}
]
]
}

what bubble recognizing it,


As in the last image, it recognizes the 2nd array as the first array type, which causes an issue while displaying data, as it doesn’t show the key of the object of the 2nd array(hash, value, markup).

That’s the issue because of arrays within another array, I know API should return the object containing arrays(which is the best practice).

And I tried every other method, but Bubble failed at that point. Now, We are stuck at the end of the project.

!!!

As it is impossible in the bubble to filter the stuff like that, what would you recommend as an alternative(third-party tool)

Could you temporarily use an external provider like a Lambda function to handle the returned formatting?

i.e. manipulate the data into a format Bubble can read and interpret

1 Like

I don’t know about it, too much

but, I’m looking for a solution

Not sure what you mean sorry…

Just route via a Lambda function and make the request. You can make ay adjustments then to the returned data type.

This might sound complex as a nocoder but Claude 3.5 Sonnet is very good at walking you through it without technical knowledge.

Hey @zamadshakil , when you do get around to reformatting the JSON, bubble can handle layers of arrays several layers deep (I’ve tested up to 20).

It just needs to be a key:value pair for the nested arrays

E.g

…
“newArray” : [
{
“Hash”:“”,
“Value”:“”,
“Markup”:“”
]
…

Good luck!

2 Likes

Issue is not Bubble in this case but More how this JSON is encoded. Both array should be under another key. This is not a bug, but a limitation.

If you have activated detect header and continue if error, you should manually edit response:

{
  "body": {
    "body": [
      [
        {
          "id": 4,
          "group": "size",
          "name": "3.5 x 2",
          "hidden": 0,
          "hash": "004debf84bce770fef3002c600a66cce",
          "value": "0.014966436518218718",
          "markup": 0
        }
      ]
    ]
  },
  "error": {
    "status_code": 200,
    "status_message": "OK",
    "body": "\"{\\\"body\\\": [[{\\\"id\\\": 4,\\\"group\\\": \\\"size\\\",\\\"name\\\": \\\"3.5 x 2\\\",\\\"hidden\\\": 0}],[{\\\"hash\\\": \\\"004debf84bce770fef3002c600a66cce\\\",\\\"value\\\": \\\"0.014966436518218718\\\",\\\"markup\\\": 0}]]}\""
  },
  "returned_an_error": false,
  "headers": {
    "date": "Sun, 15 Dec 2024 20:27:03 GMT",
    "content-type": "text/html; charset=utf-8",
    "content-length": "160",
    "connection": "keep-alive",
    "access-control-allow-origin": "*"
  }
}

And this should work. You will be able to access all data (but one in array 1 and the other in 2)

3 Likes

Jici gave a good option and djacklowcode gave great explanations for this, another option is to build this in a plugin and use JS to actually hit the API and format your own return and field extracts.

The API connect works for 90% of use cases but there are times when API providers structure things a bit weird compared to what you’d deem as the standard and require unique requirements when being called or returning data that you have to build it with custom JS in a plug-in action. It’s rare but it happens.

You shouldn’t need to use any 3rd party to accomplish this. If you need help feel free to reach out. It’s a fairly quick and easy setup.

2 Likes

Ah, I’m developing apps on bubble from last couple of yours, but :sweat_smile: today I noticed that feature(manually editing the response) of bubble.
Thanks Jici and others for your time.

appreciated

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.