File tree 1 file changed +21
-0
lines changed
lib/utilcode/src/main/java/com/blankj/utilcode/util
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,27 @@ private JsonUtils() {
26
26
throw new UnsupportedOperationException ("u can't instantiate me..." );
27
27
}
28
28
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
+
29
50
public static boolean getBoolean (final JSONObject jsonObject ,
30
51
final String key ) {
31
52
return getBoolean (jsonObject , key , false );
You can’t perform that action at this time.
0 commit comments