You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both parseJSONObject() and parseJSONArray() throw a RuntimeException if the provided JSON String is not valid.
Expected Behavior
The documentation states:
If the String does not contain JSONObject data or cannot be parsed, a null value is returned.
Both functions should therefore return null in the event of a parsing error. This would not prevent the stackTrace from being displayed in console so that the user can understand the reason.
Steps to Reproduce
Pass an invalid JSON String to either parseJSONObject() or parseJSONArray()
This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.
Description
Both parseJSONObject() and parseJSONArray() throw a RuntimeException if the provided JSON String is not valid.
Expected Behavior
The documentation states:
Both functions should therefore return null in the event of a parsing error. This would not prevent the stackTrace from being displayed in console so that the user can understand the reason.
Steps to Reproduce
My Environment
Possible Solution
In PApplet.java, we could catch the RuntimeException inside the parseJSONObject/Array(). Something like this:
I will open a pull request.
The text was updated successfully, but these errors were encountered: