title: Scala: check that a case class tree doesn't contain any null
body: <p>I use a Scala json serializer and just discovered that it doesn't set default values to case classes en deserialization, but instead set these missing values to null.</p>
  
  <p>Fortunatly it didn't damage much my system until now mostly because of CRUD only fields being set to null, but in the future, I absolutely want to enforce that my JSON payloads do not have any null values.</p>
  
  <p>My Json payloads are generally some kind of tree of case classes with lists and primitives.
  It is generally pretty simple, like a <code>case class Person(addresses: List[Address], name: String, ...)</code> with <code>case class Address(street: String, number: Int)</code> ...</p>
  
  <hr>
  
  <ul>
  <li>Is there a way to ensure that a case class has no null field in it? </li>
  <li>In case a null is found, is there a way to set it automatically to the default value instead of null? </li>
  <li>Would it work for nested case classes?</li>
  </ul>
  
  <p>I guess there's something to do with the <code>Product</code> trait but don't really know where to start.</p>