Last active
December 14, 2015 09:09
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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