Modifier and Type | Class and Description |
---|---|
static interface |
JSON.Replacer
A function that alters the behavior of the stringification process.
|
Constructor and Description |
---|
JSON() |
Modifier and Type | Method and Description |
---|---|
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 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.