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
Currently, when JSON.parse processes invalid JSON, it will throw an exception. This is not documented and can be misleading for some users that will forget to catch the exceptions.
It would be ideal to have a new API (not to break compatibility) with a signature like
deftryParse(input: String):Try[JsValue] // or with Either or similar type that encodes errordeftryParse(input: InputStream):Try[JsValue]
deftryParse(input: Array[Byte]):Try[JsValue]
in order to use the type system to prevent user mistakes.
If it is not possible at all to add a new API, at least it would be important to document that exceptions can be thrown.
Play JSON Version
2.9.x
API
Scala
The text was updated successfully, but these errors were encountered:
Currently, when
JSON.parse
processes invalid JSON, it will throw an exception. This is not documented and can be misleading for some users that will forget to catch the exceptions.It would be ideal to have a new API (not to break compatibility) with a signature like
in order to use the type system to prevent user mistakes.
If it is not possible at all to add a new API, at least it would be important to document that exceptions can be thrown.
Play JSON Version
2.9.x
API
Scala
The text was updated successfully, but these errors were encountered: