public class JSONUtil
extends Object
Constructor and Description |
---|
JSONUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addToStringCollection(Collection<String> collection,
JSONArray jsonArray) |
static void |
addToStringCollection(Collection<String> collection,
JSONArray jsonArray,
String jsonObjectKey) |
static Object |
getValue(Object object,
String... paths) |
static boolean |
hasValue(JSONArray jsonArray,
Object value) |
static JSONObject |
merge(JSONObject jsonObject1,
JSONObject jsonObject2) |
static JSONArray |
put(Object... values)
Deprecated.
As of Mueller (7.2.x), replaced by
putAll(Object...) |
static JSONArray |
put(Object value) |
static JSONObject |
put(String key,
Object value) |
static JSONArray |
putAll(Object... values) |
static JSONArray |
replace(JSONArray jsonArray,
String jsonObjectKey,
JSONObject newJSONObject) |
static <T> T[] |
toArray(JSONArray jsonArray,
com.liferay.petra.function.UnsafeFunction<JSONObject,T,Exception> unsafeFunction,
Class<?> clazz) |
static <T> JSONArray |
toJSONArray(List<T> list,
com.liferay.petra.function.UnsafeFunction<T,Object,Exception> unsafeFunction) |
static <T> JSONArray |
toJSONArray(T[] array,
com.liferay.petra.function.UnsafeFunction<T,Object,Exception> unsafeFunction) |
static <T> List<T> |
toList(JSONArray jsonArray,
com.liferay.petra.function.UnsafeFunction<JSONObject,T,Exception> unsafeFunction) |
static long[] |
toLongArray(JSONArray jsonArray) |
static long[] |
toLongArray(JSONArray jsonArray,
String jsonObjectKey) |
static List<Long> |
toLongList(JSONArray jsonArray) |
static List<Long> |
toLongList(JSONArray jsonArray,
String jsonObjectKey) |
static Set<Long> |
toLongSet(JSONArray jsonArray) |
static Set<Long> |
toLongSet(JSONArray jsonArray,
String jsonObjectKey) |
static Object[] |
toObjectArray(JSONArray jsonArray) |
static Object[] |
toObjectArray(JSONArray jsonArray,
String jsonObjectKey) |
static List<Object> |
toObjectList(JSONArray jsonArray) |
static List<Object> |
toObjectList(JSONArray jsonArray,
String jsonObjectKey) |
static Set<Object> |
toObjectSet(JSONArray jsonArray) |
static Set<Object> |
toObjectSet(JSONArray jsonArray,
String jsonObjectKey) |
static String[] |
toStringArray(JSONArray jsonArray) |
static String[] |
toStringArray(JSONArray jsonArray,
String jsonObjectKey) |
static List<String> |
toStringList(JSONArray jsonArray) |
static List<String> |
toStringList(JSONArray jsonArray,
String jsonObjectKey) |
static Set<String> |
toStringSet(JSONArray jsonArray) |
static Set<String> |
toStringSet(JSONArray jsonArray,
String jsonObjectKey) |
public static void addToStringCollection(Collection<String> collection, JSONArray jsonArray)
public static void addToStringCollection(Collection<String> collection, JSONArray jsonArray, String jsonObjectKey)
public static Object getValue(Object object, String... paths)
public static boolean hasValue(JSONArray jsonArray, Object value)
public static JSONObject merge(JSONObject jsonObject1, JSONObject jsonObject2) throws JSONException
JSONException
public static JSONArray put(Object value)
@Deprecated public static JSONArray put(Object... values)
putAll(Object...)
public static JSONObject put(String key, Object value)
public static JSONArray putAll(Object... values)
public static JSONArray replace(JSONArray jsonArray, String jsonObjectKey, JSONObject newJSONObject)
public static <T> T[] toArray(JSONArray jsonArray, com.liferay.petra.function.UnsafeFunction<JSONObject,T,Exception> unsafeFunction, Class<?> clazz) throws Exception
Exception
public static <T> JSONArray toJSONArray(List<T> list, com.liferay.petra.function.UnsafeFunction<T,Object,Exception> unsafeFunction) throws Exception
Exception
public static <T> JSONArray toJSONArray(T[] array, com.liferay.petra.function.UnsafeFunction<T,Object,Exception> unsafeFunction) throws Exception
Exception
public static <T> List<T> toList(JSONArray jsonArray, com.liferay.petra.function.UnsafeFunction<JSONObject,T,Exception> unsafeFunction) throws Exception
Exception
public static long[] toLongArray(JSONArray jsonArray)
public static long[] toLongArray(JSONArray jsonArray, String jsonObjectKey)
public static List<Long> toLongList(JSONArray jsonArray)
public static List<Long> toLongList(JSONArray jsonArray, String jsonObjectKey)
public static Set<Long> toLongSet(JSONArray jsonArray)
public static Set<Long> toLongSet(JSONArray jsonArray, String jsonObjectKey)
public static Object[] toObjectArray(JSONArray jsonArray)
public static Object[] toObjectArray(JSONArray jsonArray, String jsonObjectKey)
public static List<Object> toObjectList(JSONArray jsonArray)
public static List<Object> toObjectList(JSONArray jsonArray, String jsonObjectKey)
public static Set<Object> toObjectSet(JSONArray jsonArray)
public static Set<Object> toObjectSet(JSONArray jsonArray, String jsonObjectKey)
public static String[] toStringArray(JSONArray jsonArray)
public static String[] toStringArray(JSONArray jsonArray, String jsonObjectKey)
public static List<String> toStringList(JSONArray jsonArray)
public static List<String> toStringList(JSONArray jsonArray, String jsonObjectKey)
public static Set<String> toStringSet(JSONArray jsonArray)
public static Set<String> toStringSet(JSONArray jsonArray, String jsonObjectKey)