@@ -0,0 +1,40 @@
1+import java.nio.charset.StandardCharsets;
2+import java.io.IOException;
3+import java.nio.file.Files;
4+import java.nio.file.Paths;
6+import com.leastfixedpoint.json.*;
8+public class TestJSONParsing {
9+ public static boolean isValidJSON(String s) {
11+ Object obj = JSONReader.readFrom(s);
12+ System.out.println(obj);
13+ System.out.println(obj.getClass().getSimpleName());
15+ } catch (IOException e) {
16+ System.out.println(e);
21+ public static void main(String[] args) {
22+ if(args.length == 0) {
23+ System.out.println("Usage: java TestJSONParsing file.json");
28+ String s = new String(Files.readAllBytes(Paths.get(args[0])));
30+ System.out.println("valid");
33+ System.out.println("invalid");
35+ } catch (IOException e) {
36+ System.out.println("not found");