Modifier and Type | Class and Description |
---|---|
static interface |
JSON.Replacer
A function that alters the behavior of the stringification process.
|
Modifier and Type | Method and Description |
---|---|
static <T extends Array> |
parseForArray(String text)
Parses a JSON string, constructing the JavaScript array described by the string.
|
static NativeObject |
parseForObject(String text)
Parses a JSON string, constructing the JavaScript value or object described by the string.
|
static String |
stringify(Object obj)
Converts a JavaScript object or value to a JSON string.
|
static String |
stringify(Object obj,
int spaces)
Converts a JavaScript object or value to a JSON string.
|
static String |
stringifyNativeObject(NativeObject obj,
int spaces)
Converts a JavaScript object or value to a JSON string, using a specific replacer to avoid to print internal keys of CHART.js
|
static String |
stringifyWithReplacer(Object obj)
Converts a JavaScript object or value to a JSON string, the space value is set to -1 that no space should be used and uses a default replacer to avoid
TypeError: cyclic object value . |
static String |
stringifyWithReplacer(Object obj,
int spaces)
Converts a JavaScript object or value to a JSON string, using a default replacer to avoid
TypeError: cyclic object value . |
static String |
stringifyWithReplacer(Object obj,
JSON.Replacer replacer,
int spaces)
Converts a JavaScript object or value to a JSON string.
|
@JsOverlay public static NativeObject parseForObject(String text)
text
- the string to parse as JSON.@JsOverlay public static <T extends Array> T parseForArray(String text)
T
- type of native arraytext
- the string to parse as JSON.@JsOverlay public static String stringify(Object obj)
obj
- The value to convert to a JSON string.@JsOverlay public static String stringify(Object obj, int spaces)
obj
- The value to convert to a JSON string.spaces
- it indicates the number of space characters to use as white space; this number is capped at 10 (if it is greater, the value is just 10). Values less than 1
indicate that no space should be used.@JsOverlay public static String stringifyWithReplacer(Object obj)
TypeError: cyclic object value
.obj
- The value to convert to a JSON string.@JsOverlay public static String stringifyWithReplacer(Object obj, int spaces)
TypeError: cyclic object value
.obj
- The value to convert to a JSON string.spaces
- it indicates the number of space characters to use as white space; this number is capped at 10 (if it is greater, the value is just 10). Values less than 1
indicate that no space should be used.@JsOverlay public static String stringifyWithReplacer(Object obj, JSON.Replacer replacer, int spaces)
obj
- The value to convert to a JSON string.replacer
- A function that alters the behavior of the stringification process.spaces
- it indicates the number of space characters to use as white space; this number is capped at 10 (if it is greater, the value is just 10). Values less than 1
indicate that no space should be used.@JsOverlay public static String stringifyNativeObject(NativeObject obj, int spaces)
obj
- The value to convert to a JSON string.spaces
- it indicates the number of space characters to use as white space; this number is capped at 10 (if it is greater, the value is just 10). Values less than 1
indicate that no space should be used.