java.lang.Object
com.github.wnameless.json.base.JsonPrinter
JsonPrinter reprints any JSON input into minimal or pretty form. It only uses Java native
string processing to generate the output and no additional explicit JSON library is required.- Author:
- Wei-Ming Wu
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringminimalPrint(String json) Returns a minimal print JSON of any JSON input.static StringprettyPrint(String json) Returns a pretty print JSON of any JSON input.static StringprettyPrint(String json, String indentStr) Returns a pretty print JSON of any JSON input.static StringtoJsonString(String javaString) Converts any Java String to the JSON string representation, which is quoted and escaped properly.
-
Method Details
-
minimalPrint
Returns a minimal print JSON of any JSON input.- Parameters:
json- any JSON- Returns:
- a minimal print JSON
-
prettyPrint
Returns a pretty print JSON of any JSON input.- Parameters:
json- any JSON- Returns:
- a pretty print JSON
-
prettyPrint
Returns a pretty print JSON of any JSON input.- Parameters:
json- any JSONindentStr- a string to use as an indent- Returns:
- a pretty print JSON
-
toJsonString
Converts any Java String to the JSON string representation, which is quoted and escaped properly.- Parameters:
javaString- any Java String- Returns:
- a representation of JSON string
-