public final class JsonUtil extends Object
Constructor and Description |
---|
JsonUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addArrayField(JSONObject json,
String name,
String[] array) |
static void |
addDateField(JSONObject json,
String name,
Date date) |
static void |
addDefaultField(JSONObject json,
String name,
Object defaultValue,
Object value) |
static void |
addField(JSONObject json,
String name,
Object value) |
static void |
addListField(JSONObject json,
String name,
List<String> list) |
static List<Object> |
jsonArrayAsList(JSONArray jsonArray)
|
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 void addDefaultField(JSONObject json, String name, Object defaultValue, Object value)
public static void addListField(JSONObject json, String name, List<String> list)
public static void addArrayField(JSONObject json, String name, String[] array)
public static void addDateField(JSONObject json, String name, Date date)
Copyright © 2018. All rights reserved.