Forum Academy Marketplace Showcase Pricing Features

New FREE Plugin - JSON Machine. Work with JSON direct on the page

This might be related to the automatic JS minification that bubble does. I disabled this in the latest version. Try upgrading and let me know

Hey Jon, great plugin.

I have a quick question for you. I’ve got a json response which is a little weird, its structured like this

I want data from items and entrys arrays to be within the same line on a repeating group

my goal is to make a data base on bubble that on one row has data members from items and data members from entry

Unfortunately I can’t modify the JSON response for those to be within the same array, I was wondering if this plugin had functionality with dealing with this issue

I really appreciate your help with this, and again, thanks for making this plugin

Hi. Did you figure this out? I’m trying to do something similar. It’s a bit of a nightmare.

If I understand you correctly json.items is an array of data (texts, numbers, etc). There is corresponding data at json.includes.entry which, I presume is another array of the same length and index values.
For example: json.items[23] would have its corresponding data at json.includes.entry[23]

Data can be structured in many ways, JSON Machines supports more conventional JS object structures, which this is not, unfortunately. This may be a candidate for custom JS to loop through and pair up your data. You can PM me if you are interested in having something custom built.

As a work-around perhaps, you could build your RG off of JSON.items (with its data and index) and then use RG row index to target the other node (json.includes.entry) using that index thus pulling out your corresponding values from the other node. There are some limitations with this and it may not be elegant, but I can’t see why it wouldn’t work in theory

1 Like

@jon2, I love this plugin, so thank you for the contribution. That said, I’m struggling and hoping you or someone else on this thread might be able to help me. My use case: I’m trying to pass a list of JSON objects into a repeating group and show different templates based on one of the parameters. However, it seems the Read JSON element must be visible for the plugin to function. Any thoughts on how to work around?

Plug-in page elements do need to be shown (at least once) so their code can be loaded. The read element, however, is not visible to the user, even if it set to be ‘visible’.

I assume you could put the read element directly in the RG row so it is always “visible” when the row loads. You could then add different groups in the RG row (for your different templates) which are ‘siblings’ to the read element inside the RG row. Set those groups default visibility to hidden on page load and set a conditional to show each template based on the read element’s value.

I hope I’m answering your question.

Jon

Hi Jon,

I am able to use Json Reader to populate the text and status for a repeating group with checkboxes denoting the state of an given list item in the json list. Where I am having trouble is updating my input json by just toggling the check boxes. I setup the modify json to be triggered when the value of the checkbox changes. Watching the debugger I see the modif json correctly pull in the input json indentify the correct key for the cell and the correct value but I dont see the update occur in the textbox where the json is stored. Is there something I am doing that would prevent me from seeing update?



Thanks for any advice!
-Gregg

  • Your text box appears to be a thing in the database.
  • Your workflow shows that after checking or unchecking the row’s checkbox you run a single step which is the ‘update JSON’ action for the JSON machine element called ‘modifyJSON A’

Unless I’m missing something. It looks like you are missing the workflow step to actually update the thing that is the source of what is displayed in your text box.

hey guys,

is it possible with this plugin to convert a string to json?

I made it work to get data from the facebook graph api, but the result is always a string and not json.

I am really new to it, so i hope someone can help me with that!

In the attached screenshot you can see what I mean

It may. There may be unforeseen limitations depending on exactly what the API returns. JSON machine works best when you control the data structure–storing and retrieving JSON ‘you make’.

Can you use the GraphAPI? or blockspring / zapier? I’d take a look at this thread.

If you have more questions about the Fb API, I’d start a new thread on that :slight_smile:

Hey @jon2 ,

thanks for your quick reply.

I am using www.pathfix.com and with that the facebook graph api.

With instagram basic display api everything works great. I always get json data as results.

But with the facebook graph api (which is also the api for instagram business accounts) I always get text as a result instead of json.

I mean the the data is right, the results are right but like that I don’t know how to access the values. I can just print the text.

Also I think it could be not the solution to work with find & replace to “extract” the results I need to use, am I right?

I want to avoid hijacking the thread since others use it for support issues for JSON machine. I can answer your JSON-machine question.

JSON machine takes JSON text can can do some basic parsing on it and return values that you can use in your bubble application. If you want to take a stab at it, take a look at the demo app. You can even try copying it and making changes to the JSON data returned by the api

1 Like

Hy jon2.
I am stuck in a simple task to readJson ! I am quite noob in Bubble and programing stuff´s… so… I would really apreciate a help. I am trying to repeat the example sample, but it doesn´t work…
Could you make a step by step tutorial ?
I have a lot of questions: how store the Json ( i believe it´s stored in a Data User called in the example " json", where I could see the Json texts… ) . It has to be a User type? :roll_eyes:
And after those stored json text, how do whe read it in a whay whe could ask for only some cells? I could not ready any value… :thinking:
Sorry again for my noobish state… I has a lot of dificult to understand how to do whithout a step by step created for almost idiotic people ! :joy:
Could not copy the example in the right way… :worried:

Hi there,

I’m a bit strapped for time, and it’s unlikely that I will get around to a step by step tutorial in the near future. You can try loading the demo application in “debug mode” from the editor and running the workflows in ‘step by step’ mode to see what’s going on. Good luck!

Jon

Hi Jon,

The text box is initially populated by an API call. The JSON reader is then reading the content of the textbox. My thought was to use the textbox as a place to store the updated json before sending the blob back through my API. Should I just be sending the updates directly to the API instead of trying to update the textbox?

Cheers,
Gregg

Unfortunately, I can’t speak to what to do with your data into or out of the plug-in.

What I can say is that I don’t see any workflow step that actually does something to with the JSON you updated. From what I can tell, It looks like it is just sitting in the output state of the json machine element.

Oh! Ok so in order to see the output of the json machine element i need to reference its value. It doesnt write is value back to the source of the original json, it just stores the result internally. Just like the reader side it translates but its results must be pulled via a workflow step or a reference from another element.

Did I state the concept of how the engine works correctly? @jon2

As I have not received any help in my doubts, I will even do an update of what I have learned during my lonely fight! Maybe this helps some noob like me… :worried:
Well, so far, after 2 uninterrupted days of useless testing I was able to read a value in a Json text. :thinking:

1º - I put the Json text in a field within a Bubble DB named User (as in the example that was made available).
2º- I put 1 Group with Type of COntent = User , and Data Source = Current User.
3º- Within this Group, I put a readJSON element with Key = name of the cell we want to read , and the field of json text = Parent ́sGroup User ́s json. (json is the name of the database field that contains my JSon texts).
4º- To write this read value I put within this Group another element, a Text with a dynamic value in the text field with the name of the readJSON previously placed followed by text ́s value.

Looks like a simple operation , but it´s not!!! :roll_eyes:

Now i will try to find a value of a cell inside another cell… Maybe in 2 days again I can understand wath the f… is going on! :face_with_monocle:

I hope this could help someone. :wink:

You described this correctly. The plug-in does not talk directly to the database. it stores the output data in an internal state, you then use the bubble workflow logic to do something with that output (display it to the user, save it to the db).

Have you tried troubleshooting this inside the bubble debugger to see if the json text is actually making it to json machine? You can also put a text element that shows the contents of “current users json” just to make sure you are actually getting the value you think you are.

1 Like