scalapb json4s fail parse string boolean

69 views
Skip to first unread message

Med Ch

unread,
Apr 26, 2019, 3:55:49 PM4/26/19
to ScalaPB
Hi,
I was wondering if it was intended or not but trying to parse string boolean is actually throwing an exception. Which is accepted in the java version. 



{"keyB": "false"} this is not accepted. 


scalapb.json4s.JsonFormatException: Unexpected value (JString(true)) for field dstActive of ContextSlots

at scalapb.json4s.Parser$$anonfun$parseSingleValue$1.apply(JsonFormat.scala:323)
at scalapb.json4s.Parser$$anonfun$parseSingleValue$1.apply(JsonFormat.scala:323)
at scalapb.json4s.JsonFormat$.parsePrimitive(JsonFormat.scala:441)
at scalapb.json4s.Parser.parseSingleValue(JsonFormat.scala:322)
at scalapb.json4s.Parser.scalapb$json4s$Parser$$parseValue$1(JsonFormat.scala:283)
at scalapb.json4s.Parser$$anonfun$4$$anonfun$apply$2.apply(JsonFormat.scala:296)
at scalapb.json4s.Parser$$anonfun$4$$anonfun$apply$2.apply(JsonFormat.scala:295)
at scala.Option$WithFilter.map(Option.scala:207)
at scalapb.json4s.Parser$$anonfun$4.apply(JsonFormat.scala:295)
at scalapb.json4s.Parser$$anonfun$4.apply(JsonFormat.scala:294)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.Iterator$class.foreach(Iterator.scala:891)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1334)
at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
at scala.collection.AbstractTraversable.flatMap(Traversable.scala:104)
at scalapb.json4s.Parser.fromJsonToPMessage(JsonFormat.scala:294)
at scalapb.json4s.Parser.fromJson(JsonFormat.scala:243)
at scalapb.json4s.Parser.fromJsonString(JsonFormat.scala:238)
at scalapb.json4s.JsonFormat$.fromJsonString(JsonFormat.scala:385)

Thanks,



Nadav Samet

unread,
Apr 26, 2019, 7:50:26 PM4/26/19
to Med Ch, ScalaPB
Looks like it is undocumented behavior of the java version. I merged a commit to address it https://github.com/scalapb/scalapb-json4s/commit/c2ba28b1aa281e690097bf14ab191b3758ddfd21

--
You received this message because you are subscribed to the Google Groups "ScalaPB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalapb+u...@googlegroups.com.
To post to this group, send email to sca...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalapb/7c89c3ee-e979-4222-82ae-db0e97e0e76d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
-Nadav

Med Ch

unread,
Apr 29, 2019, 9:25:11 AM4/29/19
to ScalaPB
you're right it's not documented, thanks for the reply. 


On Friday, April 26, 2019 at 7:50:26 PM UTC-4, Nadav Samet wrote:
Looks like it is undocumented behavior of the java version. I merged a commit to address it https://github.com/scalapb/scalapb-json4s/commit/c2ba28b1aa281e690097bf14ab191b3758ddfd21

To unsubscribe from this group and stop receiving emails from it, send an email to sca...@googlegroups.com.

To post to this group, send email to sca...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalapb/7c89c3ee-e979-4222-82ae-db0e97e0e76d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
-Nadav
Reply all
Reply to author
Forward
0 new messages