Class JSON<N extends Number>
java.lang.Object
io.github.mxz_schwarz.parser.JSON<N>
-
Method Details
-
parse
Parses aStringrepresenting JSON data.- Parameters:
jsonStr- AStringrepresenting the JSON data to be parsed.- Returns:
- A
Objrepresenting the parsed data. - Throws:
JSONException- WhenjsonStrdoes not represent valid JSON data.
-
parse
public static <N extends Number> Obj parse(String jsonStr, Function<String, N> numParser) throws JSONException- Throws:
JSONException
-
parse
Parses a file containing JSON data.- Parameters:
path- APathinstance that corresponds to a JSON file to be parsed.- Returns:
- A
Objrepresenting the parsed JSON file. - Throws:
JSONException- WhenFiles.readString(Path)throwsanIOExceptionor whenparse(java.lang.String)throwsaJSONException.
-
parse
public static <N extends Number> Obj parse(Path path, Function<String, N> numParser) throws JSONException- Throws:
JSONException
-
stringify
Returns an ugly printStringrepresenting the JSON data.- Parameters:
obj- The JSON data tostringify.- Returns:
- A
Stringrepresentation of the JSON data. - Throws:
NullPointerException- Whenobjisnull/
-