public final class JsonSerializer extends Object
JsonValue
and
deserializer of JsonValue to Java objects.
For internal use only. May be renamed or removed in a future release.
Modifier and Type | Method and Description |
---|---|
static elemental.json.JsonArray |
toJson(Collection<?> beans)
Converts a collection of object into a
JsonArray , converting each
item of the collection individually. |
static elemental.json.JsonValue |
toJson(Object bean)
Converts a Java bean,
JsonSerializable instance, String, wrapper
of primitive type or enum to a JsonValue . |
static <T> T |
toObject(Class<T> type,
elemental.json.JsonValue json)
Converts a JsonValue to the corresponding Java object.
|
static <T> List<T> |
toObjects(Class<T> type,
elemental.json.JsonArray json)
Converts a JsonArray into a collection of Java objects.
|
public static elemental.json.JsonValue toJson(Object bean)
JsonSerializable
instance, String, wrapper
of primitive type or enum to a JsonValue
.
When a bean is used, a JsonObject
is returned.
bean
- Java object to be convertedpublic static elemental.json.JsonArray toJson(Collection<?> beans)
JsonArray
, converting each
item of the collection individually.beans
- the collection of objects to be convertednull
public static <T> T toObject(Class<T> type, elemental.json.JsonValue json)
JsonSerializable
instance, String, wrapper of
primitive types or an enum.T
- the resulting object typetype
- the type of the Java object convert the json tojson
- the json representation of the objectnull
if the input json
is null
public static <T> List<T> toObjects(Class<T> type, elemental.json.JsonArray json)
JsonSerializable
instances, Strings, wrappers
of primitive types or enums.T
- the resulting objects typestype
- the type of the elements in the arrayjson
- the json representation of the objectsnull
Copyright © 2025. All rights reserved.