Skip to content

2 new methods: isJSONObject() and isJSONArray() #1571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 5, 2021
Merged

2 new methods: isJSONObject() and isJSONArray() #1571

merged 1 commit into from
Dec 5, 2021

Conversation

XiXiongMaoXiong
Copy link
Contributor

@XiXiongMaoXiong XiXiongMaoXiong commented Nov 23, 2021

Check if a given input is a JSONObject or a JSONArray.

Code:

  1. isJSONObject(input)
/**
     * Checks if a given input is a JSONObject.
     *
     * @param input Anything.
     * @return true if it is a JSONObject.
     */
    public static <T> boolean isJSONObject(final T input) {
        return input instanceof JSONObject;
    }
  1. isJSONArray(input)
/**
     * Checks if a given input is a JSONArray
     *
     * @param input Anything.
     * @return true if it is a JSONArray.
     */
    public static <T> boolean isJSONArray(final T input) {
        return input instanceof JSONArray;
    }

Check if a given input is a JSONObject or a JSONArray.
@XiXiongMaoXiong
Copy link
Contributor Author

@Blankj you dead, lad?

@Dboy233
Copy link

Dboy233 commented Nov 26, 2021

He hasn't been online for a long time..
image

@XiXiongMaoXiong
Copy link
Contributor Author

He hasn't been online for a long time.. image

Probably getting bum-ra*ped by some Chinese prison warden somewhere in the PRC.

@Blankj Blankj merged commit f6ceb0f into Blankj:master Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants