1.17.x MalformedJsonException error when creating world

Discussion in 'Spigot Plugin Development' started by parpar8090, Aug 11, 2021.

  1. Hello, so I am getting this line of error when I create a "limbo" world.
    Code (Java):
    com.google.gson.JsonParseException: com.google.gson.stream.MalformedJsonException: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path $
    The error directs me to
    Code (Java):
    World limbo = wc.createWorld();
    Code (Java):
         * Creates a limbo world.
         * @return True if created, false if loaded.

        private boolean createLimbo() {
            WorldCreator wc = new WorldCreator("limbo");
            if (Bukkit.getWorld("limbo") == null) {

                World limbo = wc.createWorld();

                if (limbo != null) {
                    limbo.setSpawnLocation(0, 61, 0);
                    limbo.setGameRule(GameRule.SPAWN_RADIUS, 0);
                    limbo.setGameRule(GameRule.DO_MOB_SPAWNING, false);
                    limbo.setGameRule(GameRule.DO_TILE_DROPS, false);
                    limbo.setGameRule(GameRule.DO_FIRE_TICK, false);
                    limbo.setGameRule(GameRule.SHOW_DEATH_MESSAGES, false);
                    limbo.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false);
                    limbo.setGameRule(GameRule.DO_WEATHER_CYCLE, false);
                    limbo.getBlockAt(0, 60, 0).setType(Material.SEA_LANTERN);
                return true;
            } else {
                return false;

        public World getLimbo() {
            World world = Bukkit.getWorld("limbo");
            if (world == null) {
                Common.log("&eLimbo world was missing, creating new one!");
            return world;
    Do you know why this happens?
  2. I literally don't understand.
    What I think is happening here, is that the generatorSettings method needs to be in the new JSON format which means it needs to be:
    Code (Java):
    Since 1.13, you cannot use IDs in the superflat generator settings.

    But even that, it still does not work. Please help.
    • Like Like x 1
  3. Quoting the javadocs for WorldCreator#generatorSettings now uses JSON.

    A valid example would be
    Code (Text):
    Generator settings are much more comprehensive than they used to be.

    EDIT: I can't seem to find any tools online for easily generating these strings so I might develop a little web application :)
    #4 Aussie, Aug 12, 2021
    Last edited: Aug 12, 2021
    • Useful Useful x 1
  4. I've created a little REST endpoint which converts the Minecraft ingame strings to the valid generator json.
    Example as follow:
    Code (Text):
    GET https://api.agius.dev/api/ingame_preset?string=minecraft:bedrock,3*minecraft:stone,52*minecraft:sandstone,8*minecraft:sand;minecraft:desert
    Code (Text):
    GET https://api.agius.dev/api/ingame_preset?string=
    I haven't really sanitized if there's invalid input so it might return a failed response if it isn't correct, it also always sets lakes and features to true but you can disable that yourself this is only a basic endpoint.