Export and Import of Savable objects with JSON

Hello dear community.

I was looking at Savable object export formats and found the XML format very interesting.

I was inspired by the XML format to create a collection of objects that I could export and import in JSON format, it works similar to objects: XML Exporter and XMLImporter.

Links to some examples for you to try, as well as the export and import library.
[ EXAMPLES ]
https://github.com/JNightRide/monkey-example

[ LIBRARY ]
https://github.com/JNightRide/monkey/tree/master/core/src/main/java/org/monkey/export/json

I await your comments.

1 Like

For what it is, it’s interesting.

But maybe do a thought experiment sometime about “What if I kept my game objects separate from my scene objects?”

You lose almost nothing.

You gain tremendous flexibility and a nice separation between game logic and view logic.

You also gain the ability to ignore JME’s broken serialization mechanisms, accidentally saving a bunch of stuff not needed by the game object (meshes, materials, etc.). Suddenly, any other standard Java serialization will work. JAXB for XML, Google’s GSON for JSON… even Java’s own serialization can work.

It does mean that you have to ignore most of the simple examples in the tutorials.

1 Like