public class JavaToJSONConverters extends Object
JSON.stringify will automatically convert instances of java.util.Map to javascript objects. Instances of java.util.Collection and java Arrays will be converted to javascript arrays.
This is a final effort at conversion for other java objects that appear as values, and may be
preempted by objects which define a toJSON() method or by a replacer function passed to
JSON.stringify. The return value will, in turn, be converted according to Context.javaToJS(java.lang.Object, org.htmlunit.corejs.javascript.Scriptable) and stringified.
| Modifier and Type | Field and Description |
|---|---|
static UnaryOperator<Object> |
BEAN
Convert JavaBean to an object as long as it has at least one readable property
|
static UnaryOperator<Object> |
EMPTY_OBJECT
Always return an empty object
|
static UnaryOperator<Object> |
STRING
Convert Object to its toString() value.
|
static UnaryOperator<Object> |
THROW_TYPE_ERROR
Throw a TypeError naming the class that could not be converted
|
static UnaryOperator<Object> |
UNDEFINED
Always return undefined
|
public static final UnaryOperator<Object> STRING
public static final UnaryOperator<Object> UNDEFINED
public static final UnaryOperator<Object> EMPTY_OBJECT
public static final UnaryOperator<Object> THROW_TYPE_ERROR
public static final UnaryOperator<Object> BEAN
If unable to determine properties or if none exist, null is returned. This method can be called from other converters to provide an alternate value on a returned null.
Copyright © 2023 HtmlUnit. All rights reserved.