Skip to content
Permalink
Browse files

Add docs about Plated (circe-optics)

  • Loading branch information...
note authored and travisbrown committed Jul 9, 2019
1 parent 643691e commit d1350ab826569168d6534fc08e0f99ee7da1c6ce
Showing with 17 additions and 0 deletions.
  1. +17 −0 docs/src/main/tut/optics.md
@@ -118,6 +118,23 @@ val modifiedJson = doubleQuantities(json)

The result is a copy of the original JSON with only the `quantity` fields updated.

## Recursively modifying JSON

Sometimes you may need to recursively modify JSON. Let assume you need to transform all numbers into
strings in the example JSON:

```tut:book
import io.circe.optics.JsonOptics._
import monocle.function.Plated
Plated.transform[Json] { j =>
json.asNumber match {
case Some(n) => Json.fromString(n.toString)
case None => j
}
}(json)
```

## Dynamic

Some of the code above may look quite magical at first glance. How are we calling methods like

0 comments on commit d1350ab

Please sign in to comment.
You can’t perform that action at this time.