public final class JSON extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
toString(List<?> array)
Returns a JSON document encoding (with no indentation) of the specified
List<?> representing a JSON array, or null if array
is null. |
static String |
toString(List<?> array,
int indent)
Returns a JSON document encoding (with the specified indentation) of the
specified
List<?> representing a JSON array, or null if
array is null. |
static String |
toString(Map<String,?> object)
Returns a JSON document encoding of the specified
Map<String,?>
representing a JSON object. |
static String |
toString(Map<String,?> object,
int indent)
Returns a JSON document encoding of the specified
Map<String,?>
representing a JSON object. |
public static String toString(Map<String,?> object)
Map<String,?>
representing a JSON object.
NOTE: The property values of the specified map may only be instances
of Boolean, Number, String, List, and
Map. Objects of other classes will result in an
IllegalArgumentException.
object - The JSON object, represented as a Map<String,?>.Map<String,?>
representing a JSON object.IllegalArgumentException - If a property value of the specified map
is of a class that is not one of Boolean, Number,
String, List, or Map.NullPointerException - If properties is null.public static String toString(Map<String,?> object, int indent)
Map<String,?>
representing a JSON object.
NOTE: The property values of the specified map may only be instances
of Boolean, Number, String, List, and
Map. Objects of other classes will result in an
IllegalArgumentException.
object - The JSON object, represented as a Map<String,?>.indent - Number of spaces to indent child elements. If the specified
indent value is greater than 0, child elements are
indented and placed on a new line. If the indent value is
0, child elements are not indented, nor placed on a new
line.Map<String,?>
representing a JSON object.IllegalArgumentException - If a property value of the specified map
is of a class that is not one of Boolean, Number,
String, List, or Map; or if
indent is negative.NullPointerException - If properties is null.public static String toString(List<?> array)
List<?> representing a JSON array, or null if array
is null.
NOTE: The member values of the specified list may only be instances
of Boolean, Number, String, List, and
Map. Objects of other classes will result in an
IllegalArgumentException.
array - The JSON array, represented as a List<?>.List<?>
representing a JSON array, or null if array is
null.IllegalArgumentException - If a member of the specified list is of a
class that is not one of Boolean, Number,
String, List, or Map.public static String toString(List<?> array, int indent)
List<?> representing a JSON array, or null if
array is null.
NOTE: The member values of the specified list may only be instances
of Boolean, Number, String, List, and
Map. Objects of other classes will result in an
IllegalArgumentException.
array - The JSON array, represented as a List<?>.indent - Number of spaces to indent child elements. If the specified
indent value is greater than 0, child elements are
indented and placed on a new line. If the indent value is
0, child elements are not indented, nor placed on a new
line.List<?>
representing a JSON array, or null if array is
null.IllegalArgumentException - If a member of the specified list is of a
class that is not one of Boolean, Number,
String, List, or Map; or if
indent is negative.Copyright © 2020 OpenJAX. All rights reserved.