File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
lib/utilcode/src/main/java/com/blankj/utilcode/util Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,27 @@ private JsonUtils() {
2626 throw new UnsupportedOperationException ("u can't instantiate me..." );
2727 }
2828
29+
30+ /**
31+ * Checks if a given input is a JSONObject.
32+ *
33+ * @param input Anything.
34+ * @return true if it is a JSONObject.
35+ */
36+ public static <T > boolean isJSONObject (final T input ) {
37+ return input instanceof JSONObject ;
38+ }
39+
40+ /**
41+ * Checks if a given input is a JSONArray
42+ *
43+ * @param input Anything.
44+ * @return true if it is a JSONArray.
45+ */
46+ public static <T > boolean isJSONArray (final T input ) {
47+ return input instanceof JSONArray ;
48+ }
49+
2950 public static boolean getBoolean (final JSONObject jsonObject ,
3051 final String key ) {
3152 return getBoolean (jsonObject , key , false );
You can’t perform that action at this time.
0 commit comments