I solved this problem by creating another case class:
case class Id($oid: String)
then use it as follows:
case class User(_id: Id, ...)
You must have imported Json converters
implicit val idFormat = Json.format[Id] implicit val userFormat = Json.format[User]
source share