Skip to content

Output null for None values #64

@d6y

Description

@d6y

Hello 👋

For a case class with an optional value set to None:

case class C(a: Int, z: Option[Int])
val c = C(1, None)

...is it possible to customise derive to preserve the None values in the JSON?

E.g., to get:

{  "a": 1, "z": null }

This is possibly related to the Play note on Customize the macro to output null (hmm, if that link doesn't take you to the right section, scroll to the bottom of the page).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions