public class JsonUtil
| Type Params | Return Type | Name and description |
|---|---|---|
<T> |
public static T |
fromJson(String json, Type typeOfT)Convert JSON string to Object |
<T> |
public static T |
fromJson(Reader reader, Type typeOfT) |
<T> |
public static T |
fromJson(Reader reader, Class<T> classOfT) |
<T> |
public static T |
fromJson(String json, Class<T> classOfT)Convert JSON string to Object |
<T> |
public static T |
fromJson(String dateTimeFormat, String json, Class<T> classOfT)Convert JSON string to Object containing Date with given format |
<T> |
public static List<T> |
fromJsonArray(String json, Class<T> arrayType) |
|
public static boolean |
isValidJsonSchema(String aSchema) |
|
public static void |
mergeJsonObject(JsonObject src, JsonObject dst) |
|
public static String |
toJson(Object src)Convert an object to JSON string. |
|
public static String |
toJson(Object src, boolean prettyPrint)Convert an object to JSON string. |
|
public static String |
toJson(Object src, boolean prettyPrint, boolean excludeFieldsWithoutExposeAnnotation)Convert an object to JSON string. |
|
public static String |
toJson(Object src, boolean prettyPrint, boolean excludeFieldsWithoutExposeAnnotation, boolean disableHtmlEscaping)Convert an object to JSON string. |
|
public static String |
toJson(Object src, Type typeOfSrc)Convert an object to JSON string. |
|
public static String |
toJson(Object src, Type typeOfSrc, boolean prettyPrint)Convert an object to JSON string. |
|
public static JsonObject |
toJsonObject(Object src) |
Convert JSON string to Object
json - JSON stringtypeOfT - type of target objectConvert JSON string to Object
json - JSON stringclassOfT - class of target objectConvert JSON string to Object containing Date with given format
dateTimeFormat - Datetime formatjson - JSON stringclassOfT - class of target objectConvert an object to JSON string. Pretty print by default.
src - source objectConvert an object to JSON string.
src - source objectprettyPrint - pretty printConvert an object to JSON string.
src - source objectprettyPrint - pretty printexcludeFieldsWithoutExposeAnnotation - exclude the fields without expose annotationConvert an object to JSON string.
src - source objectprettyPrint - pretty printexcludeFieldsWithoutExposeAnnotation - exclude the fields without expose annotationdisableHtmlEscaping - - By default, Gson encode characters such as <, >, =, etc. Use this flag to configure Gson to leave these characters unchanged.Convert an object to JSON string. Pretty print by default.
src - source objecttypeOfSrc - type of sourceConvert an object to JSON string.
src - source objecttypeOfSrc - type of sourceprettyPrint - pretty print