public class Json extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Json.JsonCodec
The abstract JSON codec interface.
|
Modifier and Type | Method and Description |
---|---|
static <T> T |
fromJson(String json,
Class<T> type)
Convert the given JSON string to an object of the given type.
|
static InputStream |
toInputStream(Object o,
Class<?> type)
Convert the given object to an
InputStream . |
static String |
toJson(Object o)
Convert the given object to JSON.
|
public static String toJson(Object o)
o
- the object to convert.public static <T> T fromJson(String json, Class<T> type)
T
- the type of the object.json
- the JSON string.type
- the type of the object.public static InputStream toInputStream(Object o, Class<?> type) throws IOException
InputStream
.o
- the object to convert.type
- the type of the object.InputStream
.IOException
- if an I/O error occurs.Copyright © 2024. All rights reserved.