A simple JSON Parser written in Java without any dependencies.
Download: Latest CI Build
The JSON data structure inherits from the abstract class net.ssehub.json.JsonElement.
Implement net.ssehub.json.JsonVisitor for traversal using the visitor pattern.
Parsing:
try {
net.ssehub.json.JsonParser parser = new net.ssehub.json.JsonParser(fileOrStream);
net.ssehub.json.JsonElement result = parser.parse();
} catch (IOException | net.ssehub.json.ParsingException e) {
/* ... */
}Writing:
net.ssehub.json.JsonElement json = /* ... */;
String s1 = json.toString(); // short representation
String s2 = json.accept(new net.ssehub.json.JsonPrettyPrinter()); // pretty representationThis project is licensed under the Apache License 2.0.