title: How to get Circe to skip certain values from the enumeration?
body: <p>We have an "enumeration" like so:</p>
  
  <pre><code>sealed abstract class StatusEnumeration(val value: String)
  case object Status {
    case object Mine extends StatusEnumeration("mine")
    case object Someone extends StatusEnumeration("someone")
    case object Neighbor extends StatusEnumeration("neighbor")
    case object Unknown extends StatusEnumeration("unknown")
  }
  </code></pre>
  
  <p>This structure is dictated by our domain/needs. However, I'd like to convert this <code>StatusEnumeration</code> into an output JSON like so:</p>
  
  <pre><code>case class Root(status: StatusEnumeration)
  </code></pre>
  
  <p>I've set the following implicit encoder and it works as expected: </p>
  
  <pre><code>implicit val encoder = deriveEnumerationEncoder[StatusEnumeration]
  </code></pre>
  
  <p>However, <em>if</em> the <code>StatusEnumeration</code> is set to <code>Status.Unknown</code> I'd like for the value generation to be skipped Or just output a <code>null</code> instead (which I can then drop via <code>dropNullValues</code>). How can I do something like this? Is it even possible or do I need to redefine another set of enums?</p>
  
  <p>So far this is what I was trying when @Alec also commented to try something similar:</p>
  
  <pre><code>implicit val encoder = deriveEnumerationEncoder[StatusEnumeration].mapJson(x=&gt;{
  
      x.asString match {
        case Some("Unknown") =&gt; Json.Null
        case Some(s) =&gt; Json.fromString(s.toLowerCase) // output expect lowercase - not sure if the consumer is case-sensitive
        case None =&gt; Json.Null
      }
  
    })
  </code></pre>
  
  <p>This does seem to work as expected. Is this the recommended way or is there a better one?</p>