Skip to content
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

Deserializing Array field throws exceptions #73

Open
ArulselvanMadhavan opened this issue Nov 19, 2020 · 1 comment
Open

Deserializing Array field throws exceptions #73

ArulselvanMadhavan opened this issue Nov 19, 2020 · 1 comment

Comments

@ArulselvanMadhavan
Copy link

message EcpmA {
  required string dummy = 1;
}
message EcpmR {
    required string meta = 1;
    repeated EcpmRequestAdvertiserMessage checks = 2 [(scalapb.field).collection_type="Array"];
}
    import scalapb_circe.json._
    val er = EcpmR(meta, Array(EcpmA("something")))
    println(s"${er.asJson}")

scalapb version=0.10.0
scalapb_circe version = 0.7.1

Exception

[E] Exception in thread "main" scalapb_json.JsonFormatException: [Lcom.chartboost.adrel.models.messages.InterfaceMessages.EcpmRequestAdvertiserMessage;@4218d6a3
[E]     at scalapb_circe.Printer.serializeMessageField(JsonFormat.scala:117)
[E]     at scalapb_circe.Printer.$anonfun$toJson$1(JsonFormat.scala:159)
[E]     at scala.collection.Iterator.foreach(Iterator.scala:943)
[E]     at scala.collection.Iterator.foreach$(Iterator.scala:943)
[E]     at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
[E]     at scala.collection.IterableLike.foreach(IterableLike.scala:74)
[E]     at scala.collection.IterableLike.foreach$(IterableLike.scala:73)
[E]     at scala.collection.AbstractIterable.foreach(Iterable.scala:56)
[E]     at scalapb_circe.Printer.toJson(JsonFormat.scala:156)
[E]     at scalapb_circe.JsonFormat$.$anonfun$protoToEncoder$1(JsonFormat.scala:460)
[E]     at io.circe.Encoder$$anon$3.apply(Encoder.scala:127)
[E]     at io.circe.syntax.package$EncoderOps$.asJson$extension(package.scala:10)
[E]     at com.chartboost.adrel.serving.Main$.main(Main.scala:1020)
[E]     at com.chartboost.adrel.serving.Main.main(Main.scala)
@ArulselvanMadhavan
Copy link
Author

The same code works with List

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant