How can I rename a field during serialization with Json4s?
问题 How to easily rename field-names in json4s? From their documentation, i've tried the following snippet but it doesn't seem to rename the serial field to id . case class Person(serial: Int, firstName: String) val rename = FieldSerializer[Person](renameTo("serial", "id")) implicit val format = DefaultFormats + rename write(Person(1, "Guest")) //returns {"serial":1,"firstName":"Guest"} With Jackson library, it's pretty easy by declaring an annotation. But i'm looking for a pure scala library