Search in sources :

Example 1 with JsonParseException

use of org.apache.jena.atlas.json.JsonParseException in project jena by apache.

the class json method main.

public static void main(String... args) {
    if (args.length == 0)
        args = new String[] { "-" };
    try {
        for (String fn : args) {
            JsonValue json = null;
            try {
                json = JSON.readAny(fn);
            } catch (JsonParseException ex) {
                String name = fn.equals("-") ? "<stdin>" : fn;
                System.err.println(name + ": " + JsonParseException.formatMessage(ex.getMessage(), ex.getLine(), ex.getColumn()));
                continue;
            }
            JSON.write(IndentedWriter.stdout, json);
            IndentedWriter.stdout.ensureStartOfLine();
        }
    } finally {
        IndentedWriter.stdout.flush();
    }
}
Also used : JsonValue(org.apache.jena.atlas.json.JsonValue) JsonParseException(org.apache.jena.atlas.json.JsonParseException)

Aggregations

JsonParseException (org.apache.jena.atlas.json.JsonParseException)1 JsonValue (org.apache.jena.atlas.json.JsonValue)1