-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config.getSection() on JSON file returns com.google.gson.internal.LinkedTreeMap #1757
Comments
I checked the JSON data I used through an online JSON parser - everything works just fine; I even used json_decode() from PHP to check if I missed something in formatting - it simply works. |
Did you initialize your config as a JSON file? I know the Config class doesn't work as well with JSON as it does with YAML. Config groups = new Config("groups.json", Config.JSON);
ConfigSection g = groups.getSection("groups"); Are you doing something like that? |
Exactly that. The code in ConfigSection says that it returns new ConfigSection as its result - it just doesn’t in my case. |
This issue is still relevant, although, as @Sleepybear said (and I have switched to it), YAML works much better in such cases than JSON. |
Config class is being removed in Cloudburst, and you will be able to use Jackson directly to parse JSON and YAML, so I doubt this will get fixed unless someone else does a PR |
Expected Behavior
Config.get() returns a ConfigSection object.
Actual Behavior
It returns com.google.gson.internal.LinkedTreeMap instead of ConfigSection -> I can't use methods needed for the plugin.
Steps to Reproduce
Crashdump, Backtrace or Other Files
Actual error: https://pastebin.com/5ewcHpXY
groups.json - https://pastebin.com/MBv4c7ZG
Version of Nukkit: Nukkit git-9280804
The text was updated successfully, but these errors were encountered: