score:0

Try changing your case class to:

case class User(name: Name,gender: String ,age:Option[String])

If age won't always be there, you need to declare it as optional.

In addition, if age is actually an int in the json when specified like this:

{"name":"sagar","gendar":"male", "age":25}

Then the case class will have to be defined as:

case class User(name: Name,gender: String ,age:Option[Int])

Related Query

More Query from same tag