Play Json: Transforming a Reads[T] to Reads[Seq[T]] without implicits

前端 未结 1 1876
北荒
北荒 2021-02-19 12:12

I hava a Reads[T]. I would like to parse a Json object which is expected to be an array of T\'s. Is there a simple way to obtain a Reads[Seq[T]]<

相关标签:
1条回答
  • 2021-02-19 12:22

    There is a method for this in the Reads companion object: Reads.seq. Its parameter is usually implicit, but you can always call it explicitly if you want:

    val a: Reads[T] = ...
    val b: Reads[Seq[T]] = Reads.seq(a)
    
    0 讨论(0)
提交回复
热议问题