Jackson-like custom JSON serializers for gdscript #12539
ProgrammingMuffin
started this conversation in
Scripting
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks! I hope this is the right place to ask this question. If not, kindly guide me to the right platform.
I come from a Java background and in Java there's a serializer called the Jackson serializer. It is simply a very nice JSON serializer. Takes your object and converts it into JSON based on rules that you specify so the end result looks exactly like you expected.
https://www.baeldung.com/jackson-custom-serialization this is an excellent read into how it works in Java.
Hate it or not, Java has some decent tooling when it comes to some things and I thought gdscript could benefit from its own version of a "Jackson serializer". If it already exists, please guide me to it and we can further discuss on how to make it a more standard or known practice to use it. If it doesn't already exist, I am willing to contribute code to it, ideas, any help.
Why is this needed?
if you're writing multiplayer games in godot and you're using RPC, it doesn't serialize objects and JSON.serialize() also doesn't know how to handle custom objects/classes. This would immediately make it simple to handle custom objects and serialization. Basically stops your code from looking like this
Beta Was this translation helpful? Give feedback.
All reactions