How to use entity() with missing fields in case classes?

(Darwin Yip) #1

Say I have the following:

case class Foo(a: String, b: Int, c: Boolean = false)

How can I create a POST endpoint in which if c is not passed in the body, then use false by default?

POST /foo
{"a": "thing", "b": 3}
(Johan Andrén) #2

It depends: what marshalling are you using spray-json, jackson, something else?