Sending JSON from Bubble to XANO

Options
Is it possible to send a JSON file from Bubble i.e. [{"Object 1"},{"Object 2"},{"Object 3"}] to Xano and then have Xano convert the JSON into a CSV that the Bubble user can then download from their browser? I'm aware of the snippets that are built for this process. What I can not figure out is how to do it on Bubbles end. Mind you, I've already built the workflow in Bubble that generates the JSON file. Specifically, how do I set up the API to accept the file being generated? 

The few people I've gotten responses from have said this is super easy to set up, and yet, no one seems to be able to actually do it or offer a solution. I'm willing to pay for your time. Just reach out and be willing to solve the problem WITH ME on a zoom call so that I know how it works. 

Comments

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    Hey chase, which is the challenge? Setting up bubble to make the request to Xano? Having the result be downloaded from bubble by the user after delivery from Xano? 
  • Chase Catalano
    Options
      Both of those things. Though, from my understanding, once Xano finishes its part the CSV should automatically be downloaded by the browser. But I could of course be wrong. 
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    Do you know the structure of the object in JSON in advance? E.g. you know it contains fields X and Y and Z?
  • Chase Catalano
    Options
     Yes, there are going to technically be 5 different versions of it based on user inputs. Once I get the first one though, I'll be able to do the others. I'm a quick study. 
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    Hey  , does this look like what you are getting at? https://www.loom.com/share/15d117c0007345d9a09d58f2695f6cd8
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    Here's the snippet referenced in the vid in case that's helpful https://www.xano.com/snippet/q16RDYdt
  • Chase Catalano
    Options
     Michael from Xano made a similar video and snippet yesterday. I'm having trouble on the API connection part (bubble side).[image.png]I know the JSON structure/dynamic data goes into the body, but it seems like this is only for passing a single object at a time, not an array of objects. 
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    In my example, you would put the array into the input_array2 member. So it would be { "input_array2": }
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    valid JSON might look like { "input_array2": [{"x": "Hello", "y":0}, {"x":"There", "y": 1}]}
  • Chase Catalano
    Options
     that example for the JSON is what I think i've been looking for. Makes sense. I'll test this and let you know how it goes. 
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    No-code is so simple until it gets complicated! Hope it helped. Let me know how it goes! 
  • Chase Catalano
    Options
     Here's the API i'm using.
    [image.png]And here's the setup for the API connection in bubble.
    [image.png]And this is the error I'm getting when I initialize it.
    [image.png]Does data type need to be "file" since it's supposed to return a CSV file?
  • Chase Catalano
    Options
    I ALMOST GOT IT! [image.png]When I test it, it's not putting the second value for each column in a new row though. [image.png]
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
     OK, so this is does not look like not a list structure in JSON, but an object structure that implies a list. Can you present the data using a repeating group a long the lines of json: [{firstName: Chase, lastName: Catalano}, {firstName: Dylan}, {lastName: Morgan}]? 

    In the alternative, you can do more manipulation to take the implied structure of the screenshot above and turn it into an actual array, but I would consider what's going on upstream that would make that necessary before doing those backflips. 
  • Chase Catalano
    Options
     I tested the screenshot on actual data and got the same result (all the data in a single row split up by columns).
    [image.png]I'm going to test it with the following body:
    { "json": "",
      "file_name": ""
    }

    I'm hoping compiling the JSON independent of the API will make a difference. If not, would you be open to a zoom meeting to see if we can come up with a solution?
  • Chase Catalano
    Options
     here are the results. Per the logs, the json input looks to be receiving the correct json structure now.
    [image.png]But I'm getting this lengthy error in response.
    [image.png]Looking forward to your thoughts, thanks for all your help thus far btw!
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    Sorry was afk for my aft/eve. At a glance, body appears to be missing the outer curly braces. Can you share more screenshot of the input?
  • Chase Catalano
    Options
     here's the rest of the body.
    [image.png]
    This is the version that sends everything back in a single row, which makes me think the issue is on Xanos end. 

    The other version (with the simplified body in the api) is the one that gives me the error.
  • Chase Catalano
    Options
     honestly man, I've tried every variation I could think of to try and get this thing to work. I've taken the JSON generated by Bubble and plugged it into Xanos "Run and Debug" and it spits out exactly what I'm looking for. But when I try to pass the same JSON from bubble to xano using the API, i just keep getting this error.

    [image.png]Kill me.
  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options
    Seems like at this point might be diminishing returns on the messages, so we can pairing on a zoom might produce better results. You can book a time with me if you want to look at it live. https://calendly.com/d/cn3-3yr-hpx/60m-vip
  • Riaan Backer
    Options
    Its quite a challenge in Bubble to build a list that contains json data. I have found this article helpful. In order to get this working you will have to create a list that contains objects and then pass the whole list to Xano.Xano will then iterate through the list. 

    https://forum.bubble.io/t/mini-guide-build-complex-json-arrays/127445