Guest User

Untitled

a guest
Jan 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. import io.circe._
  2. import io.circe.syntax._
  3.  
  4. def mapStrings(json: Json)(f: String => String): Json = json.fold(
  5. json, // null
  6. _ => json, // boolean
  7. _ => json, // number
  8. str => f(str).asJson,
  9. arr => arr.map(mapStrings(_)(f)).asJson,
  10. obj => obj.mapValues(mapStrings(_)(f)).asJson
  11. )
Add Comment
Please, Sign In to add comment