Skip to content

Instantly share code, notes, and snippets.

@broknecho
broknecho / #description.md
Created May 6, 2025 16:37 — forked from fenix-hub/#description.md
GDScript JSON <> Class Serializer/Deserializer

You can find usages in the GDScript Unirest plugin

This is a fast serializer/deserializer written in GDScript to convert a JSON (Dictionary) to a class, using something similar to the Reflection concecpt. json_to_class can be used to convert a Dictionary to a Class. All keys in the Dictionary will be treated as variables and their types will be guessed in the best way possible. A class (defined by the class_name keyword) must extend Reference or Object or be an inner class, or else Godot will not able to see its properties. It is also possible to deserialize a JSON key to a class property with a different name using the export hint as a variable name.

example usage:

@broknecho
broknecho / MyNakama.gd
Created October 17, 2020 19:16 — forked from MysteryPoo/MyNakama.gd
Initial prototype for attaching dockerized dedicated Game Servers to Nakama matches
# This is a very messy prototype Autoload to test Nakama with a Dedicated Server
# This file won't do much of anything on its own, but I'm using it to drive
# a dedicated server for a game already made
extends Node
enum OP {
HOST,
STARTGAME,
LOBBYMESSAGE,
REGISTER_AS_SERVER,