public final class JsonUtil extends Object
Constructor and Description |
---|
JsonUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addArrayField(JSONObject json,
String name,
Object[] array) |
static void |
addDateField(JSONObject json,
String name,
Date date) |
static void |
addDefaultField(JSONObject json,
String name,
Object defaultValue,
Object value) |
static <T> void |
addField(JSONObject json,
String name,
JsonObjectConverter<T> converter,
T value) |
static void |
addField(JSONObject json,
String name,
Object value) |
static void |
addListField(JSONObject json,
String name,
Collection list) |
static <T> void |
addListField(JSONObject json,
String name,
JsonObjectConverter<T> converter,
List<T> list) |
static List<Object> |
jsonArrayAsList(JSONArray jsonArray)
|
static <T> List<T> |
jsonArrayAsList(JSONArray jsonArray,
JsonObjectConverter<T> converter) |
static <T> T |
jsonObject(JSONObject jsonObject,
JsonObjectConverter<T> converter) |
static Map<String,Object> |
jsonObjectAsMap(JSONObject jsonObject)
Converts a
JSONObject to a Map . |
public static Map<String,Object> jsonObjectAsMap(JSONObject jsonObject)
jsonObject
- the json object to convertpublic static List<Object> jsonArrayAsList(JSONArray jsonArray)
jsonArray
- the json array to convertpublic static void addField(JSONObject json, String name, Object value)
public static <T> void addField(JSONObject json, String name, JsonObjectConverter<T> converter, T value)
public static void addDefaultField(JSONObject json, String name, Object defaultValue, Object value)
public static void addListField(JSONObject json, String name, Collection list)
public static <T> void addListField(JSONObject json, String name, JsonObjectConverter<T> converter, List<T> list)
public static void addArrayField(JSONObject json, String name, Object[] array)
public static void addDateField(JSONObject json, String name, Date date)
public static <T> List<T> jsonArrayAsList(JSONArray jsonArray, JsonObjectConverter<T> converter)
public static <T> T jsonObject(JSONObject jsonObject, JsonObjectConverter<T> converter)
Copyright © 2018. All rights reserved.