[New Free Plugin] Json Generator

Could you share your use case (I.e. what exactly are the inputs & outputs).

If its about generating Json from a thing or list of things, check out the Demo 2 & 4 in the demos page of the transform list plugin.

Thanks, I’ve tried but can’t figure it out with the demos :stuck_out_tongue: Took me a while to figure the current workflow out as well haha…

I’m doing this to create the Json:

And this to get it:
46

The goal is to get it working in a API Workflow so when the Json is empty the API can fill it :wink:

Any idea how to make this with an API Workflow?

So the screenshots you’ve posted are of the Json generator plugin (which is client-side so can’t be used in API workflows), while my message was about the transform list plugin from bdk utilities. I’m happy to share an example if you’re looking at the transform list plugin

Yes, would be nice thanks :slight_smile:

Hey Gaurav, hope you’re well.

Just to let you know I’ve started to experience a bug with the JSON Generator plugin. I’ve been using it for weeks without issue, and I’ve changed nothing in the workflows, but for the last couple of days this is happening:

  • My workflow has been: Set Json to Json object > Send email with Json object’s data
  • The emails are now coming through with no data, Bubble log shows the Send email step has no data
  • If I set separate the original workflow into two workflows, it works again as usual: Workflow 1 - Set Json to Json object, Workflow 2 - Send email with Json object’s data

Hope that’s clear, let me know if you need more info.

Update: A bit more info. When I do Step-by-Step in the debugger it shows that the Json object is outputting correctly, and the “Send email” step shows the content of the Json object in the body of the email. Then when I check the Bubble log the “Body” part of the email step is empty! So what I’m seeing in the Step-by-Step, which is correct, is not actually running server side

Does this support generating a JSON from a repeating group of results, more than one record? How is that done?

Thanks

Well you can achieve this using Repeating Group tools (bdk) plugin
Basically you generate the json in every cell and use the plugin to extract that list of JSONs. Then just join with , for that list & put the result in array, i.e. [ extracted JSONs join with , ]

@gaurav I am also experiencing this bug. But I realized that the JSON text is 1 behind (first save is empty):

I have 1 input field and a corresponding “Add” button with a workflow:

  1. “Set to JSON” → input field’s value
  2. Create a new object in Database and set Text field to JSON’s value.
  3. Reset inputs

If I do this 3 times I am finding that entry number 1 is empty and the other entries are 1 behind:

json1

Question 1 should have Option: 1
Question 2 should have Option: 2
Question 3 should have Option: 3
…

Any thoughts?

The plugin hasn’t been edited in a long while so pretty sure it isn’t a code change issue. I think I know what’s going on in both your cases. Bubble doesn’t wait for the element’s value to be published before moving on to the next step. That’s why in @richardosborne14’s case it worked after separating the workflows as that introduces a small delay. And that also explains why if you do step by step in debugger it works as you’re causing a delay between steps.

In your case @hero, the first record starts to get processed by bubble before the output JSON element’s value gets published as bubble doesn’t wait for it. A simple workaround would be to introduce a delay by putting the creating object stuff in a custom workflow and using the ‘schedule a custom workflow with delay’ of like 0.3 seconds instead of creating object right after setting json

@gaurav Thanks for responding. I tried the delay, trigger custom event, and schedule workflow. Seems like they all produce the same issue.
Another thing I tried: setting the JSON to a default values on Page Load.
This still acts the same way (1 record behind), but now the initial Question 1 is not empty, it has the default values in there.

The only thing that seems to work is if I have 2 separate buttons on the screen - one to explicitly set the value to the inputs and another to then save the JSON to the DB. Seems like it doesn’t like to do both in 1 step.
I will keep testing other avenues, but letting you know for now.

Quick update - did more testing, and it’s definitely a 2 step process to avoid the 1 off issue:

  1. Click 1st button to set the JSON.
  2. Click 2nd button to save the JSON to the DB.

Since this impacted UX, I ended up not using the plugin and just coded the JSON myself:

  1. Editable Input field (to intake the text) = FIELD A
  2. Second Input field (FIELD B), with edit disabled, and not visible, Initial Content = JSON format wrapped around {Input FIELD A value}
  3. One Save button writing FIELD B to the DB (add to list of text).

Parsing was the other issue - some options here as well (including Run Javascript in the Toolbox plugin), but I ended up doing this manually as well by adding an HTML element on the page and adding:
<script>
var obj = JSON.parse(JSON Text from DB);
</script>

Then I leveraged the Javascript to Bubble in the Toolbox plugin to obtain the text and display it on the screen.

Hello @gaurav ,

Well, I’ve spent a whole day trying what you suggested but so far have been unsuccessful. I’m trying to create a JSON list inside a list inside a list.

Is there a quick way to provide a simple example of this using your plugin?

Thanks,
George

@gaurav how are you?

I have a platform where users are creating lists within list and needs to turn parts of it into JSON to reduce the workload unit and also data storage.

Can you tell me how I would go about doing this.

Users can select field1 (count = 5) and then within that they might want a list of field2 (count = 3). Then they want to create another field1 (count = 3) then within that they might want a list of field2 (count = 5).

I need to be able to create the JSON list for field1 and then a list of field2 inside the field1 that is dynamic and users count have any count they want to field1 or 2.

Will this work with your plugin?

Hello, what is the proper key format to use with the get value from Json action when trying to parse through a nested list? Thanks!

Essentially, I have an API providing an object, and inside of that object I have multiple fields. How would I parse just the one field I am trying to see?

스크린샷 2024-04-25 오전 10.45.55
hi
is it working well right now?
i think i cannot type any value in ‘number type’
and all i typed before also disappeared.
how can i solve this?