Package com.adobe.marketing.mobile.util
Class JSONUtils
-
- All Implemented Interfaces:
public final class JSONUtilsUtility class for JSON objects.
-
-
Method Summary
Modifier and Type Method Description static booleanisNullOrEmpty(@Nullable() JSONObject jsonObject)Checks if the provided JSONObjectis null or it has no elementstatic booleanisNullOrEmpty(@Nullable() JSONArray jsonArray)Checks if the provided JSONArrayis null or it has no elementstatic Map<String, Object>toMap(@Nullable() JSONObject jsonObject)Converts contents of a JSONObjectinto aMap<String, Object>static List<Object>toList(@Nullable() JSONArray jsonArray)Converts contents of a JSONObjectinto aList<Object>-
-
Method Detail
-
isNullOrEmpty
static boolean isNullOrEmpty(@Nullable() JSONObject jsonObject)
Checks if the provided
JSONObjectis null or it has no element- Parameters:
jsonObject- theJSONObjectto be verified- Returns:
true if null or empty, false otherwise
-
isNullOrEmpty
static boolean isNullOrEmpty(@Nullable() JSONArray jsonArray)
Checks if the provided
JSONArrayis null or it has no element- Parameters:
jsonArray- theJSONArrayto be verified- Returns:
true if null or empty, false otherwise
-
toMap
@Nullable() static Map<String, Object> toMap(@Nullable() JSONObject jsonObject)
Converts contents of a
JSONObjectinto aMap<String, Object>- Parameters:
jsonObject- theJSONObjectthat is to be converted to Map- Returns:
Map<String, Object>obtained after converting theJSONObject
-
-
-
-