play-json: mapping a json string to nested case class

80 Views Asked by At

I have a usecase where incoming json string doesn't have a structure similar to the case class. I have following case classes:

case class Parent(children: Seq[Child])
case class Child(name: Option[String], age: Option[Int])

User inputs in Parent field as:

John:20, Peter:12

Incoming json is as:

{"parent":{"parent":"John:20, Peter:12"},....}

Is it possible I write json formatter to map this to the Parent case class with nested Child list, using play framework json API?

0

There are 0 best solutions below