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

JSON Validator

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

public class ValidatorExampleApplication {

    public static ValidatorExampleApplication instance = new ValidatorExampleApplication();

    public void start() {
        System.out.println(JsonHelper.isValidJson("{\"name\": \"Matthew\"}")); // Logs true.
        System.out.println(JsonHelper.isValidJson("name: Matthew")); // Logs false.
    }

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

}

The JsonHelper class has a few utilities to make your life easier as the end-user. The JSON validator is one of said utilities. It can be used as shown above.

Clone this wiki locally