Hi everyone,

I need help with updating a User database in Bubble. I have a JSON response like this:


[
  {
    "user": "ctovla@gmail.com",
    "rating_result": "3.0"
  },
  {
    "user": "frolalala@icloud.com",
    "rating_result": "3.5"
  }
]

I want to update the rating_result field in the User database based on the user (email) provided in the JSON. Is there a plugin or a method in Bubble that can help me achieve this?

Any guidance or examples would be greatly appreciated!
Thank you!

Schedule API Workflow on a list (list type will be the type returned by the API (json)

Backend WF will have two fields: user (text) and rating (number)

In the WF you will make change to a thing with do a search for user

I tried it, but List to run on - doesn’t treat json text as a list

You are getting the JSON from API Connector?

Yeah, but then I process it in Bubble.
I bring it to the input as on the screenshot and from there I want to pass it on…
So I need to do it directly from the API only?

It’s easier
If you process it, this should be store as text list instead in your DB
so each item will be

  {
    "user": "ctovla@gmail.com",
    "rating_result": "3.0"
  }

And using regex, you could be able to use data inside this JSON object. At this moment, you will keep the data type as text like actually.

1 Like

Use regex

Schedule API Workflow set_rating on a list

Backend workflow set_rating

Make changes to User…

I got that right, didn’t I?
Just not all the way through :smiley:

No your user and and rating result are not correct in SAWOL
So you are fine with a list of text,
but now in user and rating fields. it should be something like This text:extract with regex (for both user and rating result, just a different regex)

1 Like

It seems to work judging by the logs, but alas there are 2 problems
I do not understand why adds judging by the logs only one user and why the database does not save this change, you can see in the log that for example we changed it to 3.0, but in fact in the database in avarage_rating empty… ahem


Got it!
The expression was bad, here is the correct one for user and rating_result

(?<=“user”: “)[^”]+
(?<=“rating_result”: “)[^”]+

1 Like