Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a circe AST support example #67

Merged
merged 1 commit into from
Sep 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,30 @@ val foo = """{"bar":{"seq":[1,2,3]}}""".jsonAs[Foo].fold(throw _, identity)
val json = foo.asJson
```

# circe AST support

// TODO
# AST support
In some cases, you may need to work with raw AST,
so tethys can offer you circe and json4s AST support:

# json4s AST support
## circe AST support
```scala
import tethys._
import tethys.jackson._
import tethys.derivation.auto._
import tethys.circe._

In some cases, you may need to work with raw AST,
so tethys can offer you json4s AST support:
import io.circe.Json

case class Foo(bar: Int, baz: Json)

val json = """{"bar": 1, "baz": ["some", {"arbitrary": "json"}]}"""
val foo = json.jsonAs[Foo].fold(throw _, identity)

foo.bar // 1: Int
foo.baz // [ "some", { "arbitrary" : "json" } ]: io.circe.Json
```

## json4s AST support
```scala
import tethys._
import tethys.jackson._
Expand Down