- java.lang.Object
-
- at.syntaxerror.json5.JSONStringify
-
public class JSONStringify extends Object
A utility class for serializingJSONObjectsandJSONArraysinto their string representations- Author:
- SyntaxError404
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringtoString(JSONArray array, int indentFactor)Converts a JSONArray into its string representation.static StringtoString(JSONObject object, int indentFactor)Converts a JSONObject into its string representation.
-
-
-
Method Detail
-
toString
public static String toString(JSONObject object, int indentFactor)
Converts a JSONObject into its string representation. The indentation factor enables pretty-printing and defines how many spaces (' ') should be placed before each key/value pair. A factor of< 1disables pretty-printing and discards any optional whitespace characters.indentFactor = 2:{ "key0": "value0", "key1": { "nested": 123 }, "key2": false }indentFactor = 0:{"key0":"value0","key1":{"nested":123},"key2":false}- Parameters:
object- the JSONObjectindentFactor- the indentation factor- Returns:
- the string representation
- See Also:
toString(JSONObject, int)
-
toString
public static String toString(JSONArray array, int indentFactor)
Converts a JSONArray into its string representation. The indentation factor enables pretty-printing and defines how many spaces (' ') should be placed before each index/value pair. A factor of< 1disables pretty-printing and discards any optional whitespace characters.indentFactor = 2:[ "value", { "nested": 123 }, false }indentFactor = 0:["value",{"nested":123},false]- Parameters:
array- the JSONArrayindentFactor- the indentation factor- Returns:
- the string representation
-
-