Package com.landawn.abacus.util
Class JSONUtil
java.lang.Object
com.landawn.abacus.util.JSONUtil
- Since:
- 0.8
- Author:
- Haiyang Li
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T
unwrap
(com.landawn.abacus.type.Type<? extends T> type, org.json.JSONArray jsonArray) static <T> T
unwrap
(com.landawn.abacus.type.Type<? extends T> type, org.json.JSONObject jsonObject) static <T> T
static <T> T
static <T> List<T>
unwrap
(org.json.JSONArray jsonArray) static <T> List<T>
unwrap
(org.json.JSONArray jsonArray, com.landawn.abacus.type.Type<T> elementType) static <T> List<T>
unwrap
(org.json.JSONObject jsonObject) static org.json.JSONArray
wrap
(boolean[] array) static org.json.JSONArray
wrap
(byte[] array) static org.json.JSONArray
wrap
(char[] array) static org.json.JSONArray
wrap
(double[] array) static org.json.JSONArray
wrap
(float[] array) static org.json.JSONArray
wrap
(int[] array) static org.json.JSONArray
wrap
(long[] array) static org.json.JSONArray
wrap
(short[] array) static org.json.JSONObject
wrap(entity) -> wrap(Maps.deepEntity2Map(entity, true))static org.json.JSONArray
static org.json.JSONArray
wrap
(Collection<?> coll) static org.json.JSONObject
-
Method Details
-
wrap
- Parameters:
map
-- Returns:
-
wrap
wrap(entity) -> wrap(Maps.deepEntity2Map(entity, true))- Parameters:
entity
-- Returns:
- See Also:
-
wrap
public static org.json.JSONArray wrap(boolean[] array) throws org.json.JSONException - Parameters:
array
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
wrap
public static org.json.JSONArray wrap(char[] array) throws org.json.JSONException - Parameters:
array
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
wrap
public static org.json.JSONArray wrap(byte[] array) throws org.json.JSONException - Parameters:
array
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
wrap
public static org.json.JSONArray wrap(short[] array) throws org.json.JSONException - Parameters:
array
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
wrap
public static org.json.JSONArray wrap(int[] array) throws org.json.JSONException - Parameters:
array
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
wrap
public static org.json.JSONArray wrap(long[] array) throws org.json.JSONException - Parameters:
array
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
wrap
public static org.json.JSONArray wrap(float[] array) throws org.json.JSONException - Parameters:
array
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
wrap
public static org.json.JSONArray wrap(double[] array) throws org.json.JSONException - Parameters:
array
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
wrap
- Parameters:
array
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
wrap
- Parameters:
coll
-- Returns:
-
unwrap
public static Map<String,Object> unwrap(org.json.JSONObject jsonObject) throws org.json.JSONException - Parameters:
jsonObject
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
unwrap
public static <T> T unwrap(Class<? extends T> cls, org.json.JSONObject jsonObject) throws org.json.JSONException - Type Parameters:
T
-- Parameters:
cls
-jsonObject
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
unwrap
public static <T> T unwrap(com.landawn.abacus.type.Type<? extends T> type, org.json.JSONObject jsonObject) throws org.json.JSONException - Type Parameters:
T
-- Parameters:
type
-jsonObject
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
unwrap
- Type Parameters:
T
-- Parameters:
jsonArray
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
unwrap
public static <T> List<T> unwrap(org.json.JSONArray jsonArray, Class<? extends T> elementClass) throws org.json.JSONException - Type Parameters:
T
-- Parameters:
jsonArray
-elementClass
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
unwrap
public static <T> List<T> unwrap(org.json.JSONArray jsonArray, com.landawn.abacus.type.Type<T> elementType) throws org.json.JSONException - Type Parameters:
T
-- Parameters:
jsonArray
-elementType
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
unwrap
public static <T> T unwrap(Class<? extends T> cls, org.json.JSONArray jsonArray) throws org.json.JSONException - Type Parameters:
T
-- Parameters:
cls
- array or collection classjsonArray
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-
unwrap
public static <T> T unwrap(com.landawn.abacus.type.Type<? extends T> type, org.json.JSONArray jsonArray) throws org.json.JSONException - Type Parameters:
T
-- Parameters:
type
-jsonArray
-- Returns:
- Throws:
org.json.JSONException
- the JSON exception
-