gson really doesn't like my class, does anyone know why?

its only calling .toString() on it instead of convering it to json it can parse back into an object. Class is attached.
7 Replies
JavaBot
JavaBot11mo ago
This post has been reserved for your question.
Hey @blockgoblin31! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
blockgoblin31
blockgoblin31OP11mo ago
after walking through in debugger this line is causing the problem https://github.com/google/gson/blob/main/gson/src/main/java/com/google/gson/internal/bind/MapTypeAdapterFactory.java#L218, I just need to figure out how to get it to have true for that boolean
JavaBot
JavaBot11mo ago
if (!complexMapKeySerialization) {
if (!complexMapKeySerialization) {
JavaBot
JavaBot11mo ago
static final boolean DEFAULT_COMPLEX_MAP_KEYS = false;
static final boolean DEFAULT_COMPLEX_MAP_KEYS = false;
blockgoblin31
blockgoblin31OP11mo ago
found the solution, I needed to run .enableComplexMapKeySerialization() on the GsonBuilder before getting a Gson from it
JavaBot
JavaBot11mo ago
Post Closed
This post has been closed by <@501514065068294154>.

Did you find this page helpful?