@JsType(isNative=true,
namespace="<global>")
public final class JSON
extends java.lang.Object
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 java.lang.String |
stringify(java.lang.Object obj)
Converts a JavaScript object or value to a JSON string.
|
static java.lang.String |
stringify(java.lang.Object obj,
int spaces)
Converts a JavaScript object or value to a JSON string.
|
static java.lang.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 java.lang.String |
stringifyWithReplacer(java.lang.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 java.lang.String |
stringifyWithReplacer(java.lang.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 java.lang.String |
stringifyWithReplacer(java.lang.Object obj,
JSON.Replacer replacer,
int spaces)
Converts a JavaScript object or value to a JSON string.
|
@JsOverlay public static java.lang.String stringify(java.lang.Object obj)
obj
- The value to convert to a JSON string.@JsOverlay public static java.lang.String stringify(java.lang.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 java.lang.String stringifyWithReplacer(java.lang.Object obj)
TypeError: cyclic object value
.obj
- The value to convert to a JSON string.@JsOverlay public static java.lang.String stringifyWithReplacer(java.lang.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 java.lang.String stringifyWithReplacer(java.lang.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 java.lang.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.