Creating list ofThings from nested JSON data using API

Hi all,

I’m looking to create a series of connectedThings in my app from an API call.

My data is in a JSON format, looking a bit like:

{
  "Name": "John Person",
  "Experience": [
    {
      "Company name": "Company A",
      "Positions": [
        {
          "Position name": "Director of Engineering",
          "Position dates": "Jul 2020 – Present",
        },
        {
          "Position name": "VP of Engineering",
          "Position dates": "Dec 2019 – Jul 2020",
        }
      ]
    },
    {
      "Company name": "Company B",
      "Positions": [
        {
          "Position name": "Software Engineer",
          "Position dates": "Dec 2017 – Nov 2019",
        }
      ]
    },  ],
}

Essentially, this is just a “Person” thing, who is associated with a list of “Experience” things.
The “Experience” things each have a “Company” thing associated with them, and a list of “Position” things. I need to be able to take this JSON input and create each of these Things and their associations.

I’ve seen some solutions on the forum involving recursing API calls, but considering the number of users who may be sending the initial API calls we might have I’m worried that this solution will quickly breach the 100 API calls/minute limit that Bubble has. It looks particularly expensive since there’s a list of Things (“Experiences”) each containing another list of Things (“Position Things”).

Do any of you know an efficient way to do this?

Depending of what you need to do with this data, you can also directly store the Experience in an field (you need to set the API Call to DATA type to be able to make this).

The only other solution is to use Backend WF like some user have suggested. This take a lot of time to process and can take a lot of capacity. You need to be sure to put enough time between each loop

1 Like

I don’t quite understand what you mean by storing the Experience in a field - do you mean storing the list of Experiences as a text field on the Person Thing, and then doing something with that?

As another idea, is it possible to use some Javascript inside the workflow to help manage the process?

That’s what I understood and what I would suggest, too. You can then use the JSON Machine plugin to manipulate that JSON.

But it assumes that you do not need that JSON data converted to Bubble data.

Yes. The Toolbox plugin lets you do that. But I’m not sure this particular plugin runs in the Backend Workflows tab.


There is? I don’t see any mention on the pricing page. Is it in the manual somewhere?

I’m thinking you could:

  1. on the front-end, the user pulls his CV JSON and then you save the JSON to a ‘queue’
  2. that kicks off a recursive workflow that iterates on each JSON
    1. takes the first person
      1. which iterates to save each Experience
      • when that is done
      1. it iterates on Positions
    2. when that is done it switches a isProcessed to true and then you can let the user know that his data has been migrated.
    3. when that person is done, rinse & repeat

No. I mean to store the json. Not as a text but as an api connector thing. When you create a data type call in api connector, this will be available as a thing like if you have created a new Bubble db thing. You can choose this type like you do for a related thing. And you can also choose this in RG as data type. I will try to post screenshot later

Ah, yeah, I see your point. That’s a good idea, indeed.



screenshot-bubble.io-2021.01.08-08_16_01

In this example, the API Connector return a list of hospitals. So I can create a List of “Get Hospital” in DB. If your API connector return nested array like your case, you will be able to select “Experience” as a type and “Positions” as a type too.

Before using this, you need to consider two things:
A) Is this will be the only source information for this type of data. In your case, will this be the only source for “experience” and “positions”? If no, you may be better to create a thing instead.
B) Do you need to modify this data? If yes, you will need to create a thing.

Those are some very interesting ideas, thanks so much for the suggestions.
Once the API call comes in I’ll have to work with the data a bit, so I think it needs to be transformed into their respective Things relatively soon afterwards. Let me digest some of this info and I’ll let you know if I have any questions :slight_smile:

I need your suggestion.
What if there will be a lot of sources for this type of data?
I’m going to receive webhooks from my customer websites and the webhooks will
contain lists of SKUs which maybe from 1 SKU to any number the end-user purchased from each time.
What would you do in this case?

@mitchscott94
I have big nested json.
{
“eventName”: “”,
“eventDesc”: “”,
“subcatId”: ,
“recurringFrom”: “”,
“recurringUntil”: “”,
“isPublic”: ,
“isActive”: ,
“langCode”: “”,
“recurringCode”: “”,
“sessionStartTime”: “”,
“sessionEndTime”: “”,
“sessionWeekdays”: “”,
“sessions”: [{
“sessionName”: “”,
“sessionDesc”: “”,
“sessionStartsOn”: “”,
“sessionEndsOn”: “”,
“isCancelled”: ,
“numRegistrations”: ,
“numSeats”: ,
“sessionChannels”: [{
“channelCode”: “”,
“channelConfig”: “”
}]
}],
“channels”: [{
“channelCode”: “”,
“channelLink”: “”,
“effectiveFrom”: “”,
“effectiveUntil”: “”
}]
}

here sessions and channels are again for sending list ofsessions and channels.
How can we perform this kind of nested jsons for list of objects from API conncetor for post and put requests?

Hello @mitchscott94 ,

Hope you are well.

Have you been able to save your JSON result in the Database ? If so, able to share some sreenshots please ?

Many thanks,

Armand