public class Jsons extends Object
| Modifier and Type | Field and Description |
|---|---|
static Jsons |
DEFAULT
默认不排除任何属性
|
static Jsons |
EXCLUDE_DEFAULT
忽略对象中值为默认值的属性
|
static Jsons |
EXCLUDE_EMPTY
忽略对象中值为NULL或""的属性
|
| Modifier and Type | Method and Description |
|---|---|
com.fasterxml.jackson.databind.JavaType |
createCollectionType(Class<?> collectionClass,
Class<?>... elementClasses)
construct collection type
|
<T> T |
fromJson(String json,
Class<T> target)
deserialize a json to target class object
|
<T> T |
fromJson(String jsonString,
com.fasterxml.jackson.databind.JavaType javaType)
反序列化
|
String |
toJson(Object target)
convert an object(POJO, Collection, ...) to json string
|
public static final Jsons EXCLUDE_EMPTY
public static final Jsons EXCLUDE_DEFAULT
public static final Jsons DEFAULT
public String toJson(Object target)
target - target objectJsonException - the exception for jsonpublic <T> T fromJson(String json, Class<T> target)
T - the generic typejson - json stringtarget - target classJsonException - the exception for jsonpublic <T> T fromJson(String jsonString, com.fasterxml.jackson.databind.JavaType javaType)
T - the generic typejavaType - JavaTypejsonString - json stringJsonException - the exception for jsoncreateCollectionType(Class, Class...)Copyright © 2018. All rights reserved.