title: Scala Json4s CustomKeySerializer
body: <p>I'm trying to make all keys in a json object formatted in PascalCase when serializing a <code>case class</code>. It looks like the right way to do this is to define a <code>CustomKeySerializer</code> from the <code>org.json4s</code> package and reformat keys as I wish. However, while I am able to get a <code>CustomSerializer</code> to work, I'm not able to get a <code>CustomKeySerializer</code> to actually get used when serializing a case class (with nested case classes of unknown types). My code looks like the following:</p>
  
  <pre><code>case object PascalCaseSerializer extends CustomKeySerializer[String](format =&gt; (
    { case _ =&gt; "this is the deserializer and I don't need it" },
    { case _ =&gt; "this does nothing" }
  ))
  implicit val formats: Formats = DefaultFormats + PascalCaseSerializer
  
  case class Foo(thingId: Int, eventData: Any)
  case class Bar(numThings: Int)
  val event = Foo(1, Bar(2))
  
  val payloadJson = write(event) // """{"thingId":1,"eventData":{"numThings":2}}"""
  </code></pre>
  
  <p>What am I missing here?</p>