What is a good way to handle default values with spray-json

I stumbled upon the same problem. I've create a patch that solves it for me. It makes fields with a default value optional.

https://github.com/spray/spray-json/pull/56

update: PR is updated and still open https://github.com/spray/spray-json/pull/93


I have never used spray, but here's my guess about what may work:

case class Car(numberOfWheels: Int, color: String) {
  def this(color: String) = this(4, color)
}

object Car {
  def apply(color: String) = new Car(color)
}

Maybe now jsonFormat1(Car) will work.