I wrote an application that takes a JSON file as configuration. Up to this point, I wrote the JSON config by hand. However, now I want to allow other users who are not familiar with JSON format to make their own configurations. There's only 3 types of objects that the configuration needs to store, but the user should be allowed to add multiple copies of these objects. I want to write a configuration application where the user can press a button such as "Add Type A" and an object of type A is populated with default values and visualized so that the user can select properties and edit them. I know how to write an application that does this, but I feel like I'm re-inventing the wheel. Does anyone know of an open-source Java library that I can use inside my config application to handle visualization and editing a JSON file? If I'm approaching this from completely the wrong direction, please let me know.
Asked
Active
Viewed 2,364 times
1 Answers
0
I'm tempted to say "don't fear to reinvent the wheel". But the fact is that there a bunch solutions available :
How do I convert an object to JSON representation (and vice-versa)
Java representation of JSON Object
Javascript to Java using JSON
among them, GSON looks fine.
For my personal experience, Yaml turned out to be an appropriate solution.
-
GSON works very well for conversion and has a very clean implementation (just function calls). – Code Whisperer Sep 15 '16 at 19:40
-
I'm currently using GSON and it works great. But I'm interested more in how the JSON file is visualized and edited by people without a software background. I thought maybe there would be a visual editor based on a grammar that allows one to easily add / edit nodes in the JSON tree. There's an online editor such as this: http://www.jsoneditoronline.org/, but that's really just a small step beyond notepad text editor. Would be nice if there was a way to add some auto-checking and auto-populating of parameters with default values. – PentiumPro200 Sep 15 '16 at 21:26