Skip to content
This repository has been archived by the owner on Oct 3, 2021. It is now read-only.

Add functionality not to serialize default values #2

Open
ChocPanda opened this issue Nov 11, 2018 · 0 comments
Open

Add functionality not to serialize default values #2

ChocPanda opened this issue Nov 11, 2018 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ChocPanda
Copy link
Owner

Add the same functionality as Argonaut Shapeless with regards to Default values

Like upickle, fields equal to their default value are not put in the result JSON object.

case class CC(i: Int = 4, s: String = "foo")

CC().asJson.nospaces == "{}"
CC(i = 3).asJson.nospaces == """{"i":3}"""
CC(i = 4, s = "baz").asJson.nospaces == """{"s":"baz"}"""

"{}".decodeOption[CC] == Some(CC())
"""{"i":2}""".decodeOption[CC] == Some(CC(i = 2))
"""{"s":"a"}""".decodeOption[CC] == Some(CC(s = "a"))
@ChocPanda ChocPanda added enhancement New feature or request help wanted Extra attention is needed labels Nov 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant