import net.liftweb.json._
import net.liftweb.json.JsonParser._
object test02 extends App {
implicit val formats = DefaultFormats
case class User(
id: Int = 0,
name: String = "John Doe",
gender: String = "M")
val s1=""" {"id":1,"name":"Bill","gender":"M"} """
var r1=Serialization.read[User](s1)
println(r1)
val s2=""" {"id":1} """
var r2=Serialization.read[User](s2)
println(r2)
}
Second Serialization.read causes exception: net.liftweb.json.MappingException: No usable value for name.
How could I possibly read data form json into case class, but if some fields are missing they are replaced with default values from case class?