A simple JSON Library for java, still in development.
- Add JSON variables to file;
- Read file for existing variables before writing new ones;
- Only write when
JSONBuilder.makeJSON()is called; - Make a JSONFormatter class.
Here's an example usage of JSONutils:
JSON jsonFile = new JSONBuilder("/directory/file.json").newVariable("IsLibraryComplete", false).makeJSON();Explanation:
jsonFileis an instance of the JSON class;jsonFileis instantiated using JSONBuilder for adding variables and building the JSON usingmakeJSON();JSONBuilderhas(not yet) many methods to build a JSON file, such asnewVariable(String key, Object value), andmakeJSON();JSONBuilderis extended from theJSONclass;makeJSON()has to be used in the end of the line;newVariable()adds the variable to a HashMap, which inmakeJSON()will be written to a file, just likeWriter.flush().