Forum Academy Marketplace Showcase Pricing Features

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

User testing in preview can be tricky. I’d double check and make sure you are testing the user that you think you are. You can display the current users email. This sounds like a permissions issue.

Good luck

1 Like

Jon, you rulles dude.
Indeed it was a current user issue…
whem i register and log in a user it updated! Strange preview´s peculiarity…:face_with_monocle:
Are you from Bubble team, or do you have only Json MAchine plugin? If you´re not from bubble, they should consider contracts you!
Thank you very much for your help. :+1: :pray:

Been there

Been there with this exact issue myself. If you spend enough time beating your head against the wall, eventually you may also become an ‘expert’ (I use that term for myself very loosely)

1 Like

Now I have new issues… Json Machine is not easy to use at the same time it is…
1- I canot acess data inside [ ] . I tried all options … i could read the inside [] values in a Text, but could not acess it by readJson. Anyone can help me with this?
Another question is:
2- can I use a json data out of the User DB? I tryed to make another one, but it seens i can readJson only in User DB, and, in a field called “json”, just like in example sample… I think this should be something I missed because there´s not any logic in mantain such limits!
Any help should be highly apreciated! Thanks in advance.

Strage things, as always with me!
I can get “members” fields, but I cannot acess the inside members list of jsons! Tryed thousands of configs. :thinking:
Anyone knows how to get only one field inside another? I did it like the example and doesn´t works… Aff . … :unamused:

As soon no awsers has been given to me, I returned after smashing my head in the screen until it works!
To take values within cells that are inside cells you need to go deeper and deeper into the hierarchy, obviously. But doing this isn’t as easy as it seems… so I’m going to play my workflow.

At each step in the hierarchy we must create a Group, or a Repeating Group to select the search space. So within this group we insert a ReadJson.Having taken the first level, we took another group or repeating group inside the first one.

Going into detail my assembly was like this:
1st group with User Type=User, Data Source= current User.
2nd within this Group we created a Repeating Group that will receive the ReadJson’s “Json variable from the beginning of the hierarchy” +get listOfJsonstexts" and a text with “current cell text” to get the value taken back.
3nd As I select the indexes that should be searched for by a Dropdown, I added within the latter a Repeating Group, type of content=text, and data source=Multidropdown Value’s.
4nd Still within this Repeating Group I put a readJson with key=current cell and json text=readJson of this same Repeating group + get list of Json texts.
5nd A Text will read this readJson value to draw it on the screen. A Text will read this readJson value to draw it on the screen.
6nd At each step in the hierarchy we add a Repeating group within the other with a readJson for each and a Text returning the d oReadJson values of the cell. At each step in the hierarchy we add a Repeating group within the other with a readJson for each and a Text returning the ReadJson values of the cell At each step in the hierarchy we add a Repeating group within the other with a readJson for each and a Text returning the d oReadJson values of the current cell

I hope this could help the comunitty, if yes, leave a Heart!

1 Like

Hi @jon2 ,

Thanks for the awesome plugin!

I’m trying to use the plugin to read something like this:
[{“Sales":"[email protected]”,“Monthly Sale”:100000,“Month”:6},{“Sales":"[email protected]”,“Monthly Sale”:200000,“Month”:4}]
In your example app, there is already a key “member” for the nested JSON text for the readjson element. Can you please provide some insights of how to read the JSON text above without a key?

Thanks,
Evan

JSON Machine uses text which defines an object in Javascript. What you’ve got here is text which defines an array and JSON machine cannot work with that natively. You could try merging your array’s text with the necessary text to convert the array into an object.

something like:

{ "examplearraykey" : + ** your array text ** + }

which should produce this as the output:
{ "examplearraykey" : [{“Sales":"[email protected]”,“Monthly Sale”:100000,“Month”:6},{“Sales":"[email protected]”,“Monthly Sale”:200000,“Month”:4}] }

This has now been formatted as the proper JSON object, which can be worked on with JSON machine, just target ‘examplearraykey’.

1 Like

Hi @jon2

Thank you so much for your suggestion! That makes sense!

Evan

Hey @jon2 !

Thanks for the plugin, it is really good ! Except that I’m encountering a bug in the Update action, on the JSON_arr field which is expected as json_arr in the code :slight_smile:
Could you fix it ? :slight_smile:

And there is also a bug in the parseArrayOfJSONs function, where you are using for (let jsonItem in arr) instead of for (let jsonItem of arr) (so you’re iterating on indexes instead of array’s items themselves :slight_smile: )

Hi Florian,

Nice catch. I’m thinking I don’t code enough in ES5 to use that somewhat-confusing nomenclature reliably :slight_smile: I’m surprised this hasn’t been mentioned before!

I’ll look at it.

I’ve pushed a fix. Take a look and let me know if you have any problems

It seems ok, thanks !

I’ve published a complementary plugin, allowing to use JSONata on a JSON ! Feel free to enjoy it :stuck_out_tongue:

1 Like

I’ve found another bug, in the readJSON operator, in the function getValue(key) function declaration.

The following “if / else” (used when you have a key containing some . separators) is not working to get “non object” results.

		if (key.split('.').length > 1){
			let foundObj = obj;
			for (let thisKey of key.split('.')){
				if (typeof foundObj[thisKey] == 'object'){
					foundObj = foundObj[thisKey]
				}
				else {
					return foundObj;
				}
			}
			return foundObj;
		}

Indeed, if the last item targeted by the key is not an object (so if typeof foundObj[thisKey] == 'object' is false), it’s the foundObj which is returned (which is the object from the previous iteration) instead of foundObj[thisKey].

So, in fact, I think you should do a return foundObj[thisKey]; here. (I think the return is here to interrupt the loop if you reached a non-object point ?).

1 Like

Are you experiencing an unexpected behavior at runtime?

Yes, for example :

Input JSON :

{
  "firstLevel": {
    "secondLevel": "value"
  }
}

Key : firstLevel.secondLevel

Expected result :

"value"

Current result :

{
  "secondLevel": "value"
}
1 Like

Great plugin!

I’m facing a similar issue because of the dot thing (.) In the key itself

I have an key called ‘topics.topic-level1’ that the plugin doesn’t recognize as a key or return any values … this an external service and I don’t have control of the key naming conviction. Tried to add " or ’ but didn’t work as well.

Any solution for that?

Hi all!
I’ve published a new plugin after fighting a lot with JSON Machine and other json related plugins. I think I took all the best things in one plugin, which easily stores and reads json data as well as support JsonPath format for reading.

@jon2 Feel free to update JSON Machine plugin with my code if you find something useful.
Have fun!

1 Like

Great to see the community working to improve JSON support!

I may do this if I find the time. :slight_smile: JSON machine was initially built out of a personal need but clearly has many, many more use cases and a lot of room for improvement and I’m glad to see an effort made to do just that!

I’ve since stopped active development of JSON machine and am only making bug-fix updates and even that isn’t where I’d like it to be.

Congrats on the launch!

1 Like