java.lang.Object
at.syntaxerror.json5.JSONStringify
A utility class for serializing
JSONObjects and
JSONArrays into their string representations- Author:
- SyntaxError404
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringConverts a JSONArray into its string representation.static StringtoString(JSONArray array, int indentFactor, JSONOptions options) Converts a JSONArray into its string representation.static StringtoString(JSONObject object, int indentFactor) Converts a JSONObject into its string representation.static StringtoString(JSONObject object, int indentFactor, JSONOptions options) Converts a JSONObject into its string representation.
-
Method Details
-
toString
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 factoroptions- the options for stringifying- Returns:
- the string representation
- Since:
- 1.1.0
-
toString
Converts a JSONArray into its string representation. The indentation factor enables pretty-printing and defines how many spaces (' ') should be placed before each value. 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 factoroptions- the options for stringifying- Returns:
- the string representation
- Since:
- 1.1.0
-
toString
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}This uses thedefault options- Parameters:
object- the JSONObjectindentFactor- the indentation factor- Returns:
- the string representation
-
toString
Converts a JSONArray into its string representation. The indentation factor enables pretty-printing and defines how many spaces (' ') should be placed before each value. A factor of< 1disables pretty-printing and discards any optional whitespace characters.indentFactor = 2:[ "value", { "nested": 123 }, false ]indentFactor = 0:["value",{"nested":123},false]This uses thedefault options- Parameters:
array- the JSONArrayindentFactor- the indentation factor- Returns:
- the string representation
-