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
It appears that attempt to parse a string literal (not enclosed in an object), leads to an error:
"Json.parse" should "work" in {
Json.parse("\"test\"")
}
yields
[info] - should work *** FAILED ***
[info] grapple.json.JsonParserError: Unexpected character '"' at offset 0
[info] at grapple.json.JsonParserError$.apply(JsonException.scala:50)
[info] at grapple.json.JsonParserImpl.unexpectedChar(JsonParserImpl.scala:300)
[info] at grapple.json.JsonParserImpl.firstEvent(JsonParserImpl.scala:117)
[info] at grapple.json.JsonParserImpl.init$$anonfun$1(JsonParserImpl.scala:97)
[info] at scala.util.Try$.apply(Try.scala:210)
[info] at grapple.json.JsonParserImpl.init(JsonParserImpl.scala:97)
[info] at grapple.json.JsonParserImpl.hasNext(JsonParserImpl.scala:43)
[info] at grapple.json.JsonParserImpl.next(JsonParserImpl.scala:49)
[info] at grapple.json.JsonReaderImpl.read(JsonReaderImpl.scala:27)
[info] at grapple.json.Json$.parse(Json.scala:59)
The text was updated successfully, but these errors were encountered:
Json.parse(String) is intended for JSON structures only – i.e., JsonObject and JsonArray. Although not expressly stated, see return type for Json in scaladoc.
That said, I will consider changing the implementation to parse any JSON value... and will most certainly update the documentation.
The scaladoc for all parse methods is updated. An annotation is applied indicating that JsonParserError is thrown if argument cannot be parsed to JSON structure. See commit 9fc4520.
No enhancement is applied to parse other JSON values.
It appears that attempt to parse a string literal (not enclosed in an object), leads to an error:
yields
The text was updated successfully, but these errors were encountered: