Other JsonTree - Tool to help with JSON parsing (B4A / B4J)

SS-2013-12-23_10.11.49.png


JsonTree is a tool that helps developers to parse and understand JSON strings.

It shows the data structure in a TreeView and it also prints the code (B4J / B4A) required in order to extract the data from the string.

Note that variables in the generated code are based on the JSON fields. It may produce invalid identifiers. However it should be quite simple to take the generated code and use it in your app.

The compiled jar can be downloaded here: www.b4x.com/b4j/files/JsonTree.jar

An online version of this tool is available here: http://basic4ppc.com:51042/json/index.html

The source code is attached.

Updated project: https://www.b4x.com/android/forum/t...with-json-parsing-updated-as-23-4-2022.140068
 

Attachments

  • JsonTree.zip
    3.8 KB · Views: 3,751
Last edited:

Ju Yang

Active Member
Licensed User
Longtime User
I have copied the "JsonTree.zip" to my windows 8 system, and released it from the IDE.
It run well on windows, then I copied the jar file under the object folder to my virtualbox MAC OS X 10 systerm, and run it, but error ocurred!
I can't run the jar file on the virtualbox mac os x sytem, the same problem happened to my own programme. My virtualbox MAC system uses the jre8u65 for macosx-x64

Why error happened?

Waiting for your reply and Thank you!
 

ming

New Member
Licensed User
Longtime User
SS-2013-12-23_10.11.49.png


JsonTree is a tool that helps developers to parse and understand JSON strings.

It shows the data structure in a TreeView and it also prints the code (B4J / B4A) required in order to extract the data from the string.

Note that variables in the generated code are based on the JSON fields. It may produce invalid identifiers. However it should be quite simple to take the generated code and use it in your app.

The compiled jar can be downloaded here: www.b4x.com/b4j/files/JsonTree.jar

An online version of this tool is available here: http://basic4ppc.com:51042/json/index.html

The source code is attached.
It works fine:

SS-2013-12-29_09.15.30.png


This is the exact code you need to use in order to access the items.
This works great, but how do I save the Json tree from treeitem(TreeView) back to Json string form for changes made to Json tree? Any sample code around available?
 

ming

New Member
Licensed User
Longtime User
Yes, has dynamically make change to the tree, want to save back as Json and pass back to server. Any hope for any one pointing a direction to a similar solution?
 

ming

New Member
Licensed User
Longtime User
Creating a generic 'tree to json' converter does require some work. However if don't need lists for example then it should be quite simple to convert it back.
Erel, thanks you for your prompt response. I will keep on knock my head against this rock until some smart one share their code or I made it.:D
 

Swissmade

Well-Known Member
Licensed User
Longtime User
Thanks @Erel help me to get the Job faster.
 

JakeBullet70

Well-Known Member
Licensed User
Longtime User
Thanks @Erel help me to get the Job faster.

To me this should just be included in 'Tools' download. (a separate download with stand alone tools) There as a very good helper programs just burred in the forum and if your like me you cannot find anything no matter how hard you look. (BBCodeDesigner, FormsBuilder are some other good tools)
 

Acuario

Active Member
Licensed User
Longtime User
Great tool but can it be updated so the Root isn't called Root as it clashes with the B4X pages Root and causes errors.
 
Top