public void save() {
        Path file = this.configuration.getPlugin().getBootstrap().getDataDirectory().resolve("contexts.json");

        try (BufferedWriter writer = Files.newBufferedWriter(file, StandardCharsets.UTF_8)) {
            JsonObject data = new JsonObject();
            data.add("static-contexts", ContextSetJsonSerializer.serialize(this.staticContexts));
            data.add("default-contexts", ContextSetJsonSerializer.serialize(this.defaultContexts));

            new GsonBuilder().setPrettyPrinting().create().toJson(data, writer);
            writer.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
A wrapper for the 'contexts.json' file.
common/src/main/java/me/lucko/luckperms/common/config/ContextsFile.java