Skip to content

Instantly share code, notes, and snippets.

@stanislav-chetvertkov
Created July 18, 2018 18:01
Show Gist options
  • Save stanislav-chetvertkov/90807ab4f3e78f0cabccacb2b606c410 to your computer and use it in GitHub Desktop.
Save stanislav-chetvertkov/90807ab4f3e78f0cabccacb2b606c410 to your computer and use it in GitHub Desktop.
json omit nulls
implicit class FooBar(val json: Json) extends AnyVal {
def omitNull: Json = json
.mapArray(_.map(_.omitNull))
.mapObject(_
.filter { case (_, v) => !v.isNull }
.mapValues(_.omitNull)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment