#JSON GSON Problem
1 messages · Page 1 of 1 (latest)
so you dont want to include that File object in your json file?
gson will be default try to serialize every field it comes accross
So you're saying that because the tribes_folder file is initialized inside of the TribeData class, GSON will try to serialize tribes_folder when it serializes a TribeData object?
ye
if you dont want that declare it as transient
``private final transient File tribesFile`
Okay, it looks like it's throwing a new error now Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final int java.lang.ThreadLocal.threadLocalHashCode accessible: module java.base does not "opens java.lang" to unnamed module @109b1232
uh fuck could you sent that class again?
ah got it
at what line does it happen and whats on that line?
Sorry, I had to put up Christmas lights with my dad. The error is still on the gson.toJson(tribe, writer)
This is the stacktrace for that error
This is the TribeData file: https://paste.md-5.net/irogoyijab.cs
This is the TribeCommand file: https://paste.md-5.net/uyegopahaq.java
The error is referring to line 38 in the TribeCommand paste
you have a Gson field in your TribeData class
id recommend having ONE global gson instance cuz its heavy to instantiate
and make it static
ig its trying to serialze it
So slap one in the main class and call it from there?