Skip to content
This repository was archived by the owner on Nov 27, 2021. It is now read-only.

Prettifier and Unprettifier

MatthewTGM edited this page Jun 30, 2021 · 1 revision
import xyz.matthewtgm.json.entities.JsonObject;
import xyz.matthewtgm.json.util.JsonHelper;

public class PrettyExampleAppliation {

    public static PrettyExampleAppliation instance = new PrettyExampleAppliation();

    public void start() {
        JsonObject object = new JsonObject().add("name", "Matthew").add("language", "Java");
        String prettified = JsonHelper.makePretty(object, 2);
        System.out.println(prettified);
        System.out.println(JsonHelper.makeUnpretty(prettified));
    }

    public static void main(String[] args) {
        PrettyExampleAppliation.instance.start();
    }

}

There's also a built-in JSON prettifier and unprettifier. This makes the JSON string have indents, which in turn makes it more read-able.

Clone this wiki locally