Skip to content

Instantly share code, notes, and snippets.

@mandubian
Last active December 14, 2015 09:09
Show Gist options
  • Save mandubian/5063173 to your computer and use it in GitHub Desktop.
Save mandubian/5063173 to your computer and use it in GitHub Desktop.
How to write a #Json #Reads which replaces a key by another one and prunes the original branch ? #play2.1 #scala
val reads = __.json.update( // copies the full JSON
(__ \ "_id").json.copyFrom( (__ \ 'id).json.pick ) // adds _id
) andThen (__ \ "id").json.prune) // and after removes id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment