This is a normal sbt project. You can compile code with sbt compile
, test it with sbt test
, and sbt console
will start a Scala 3 REPL.
type Json = JsonObject | JsonArray | Double | String | Boolean | NullMacro JSON string interpolation
The string interpolator json
defined in JsonStringContext.scala provides shows how to implement the interpolator apply
and unapply
with macros.
val user = json"""{ "firstName": "John", "lastName": "Doe" }""" val bool = json"true" val account = json"""{ "user": $user, "active": $bool }"""
where the type of account
is refined to
account: JsonObject { val user: JsonObject { val firstName: String val lastName:String } val active: Boolean }Extracting refined JSON with an interpolator
(account: Json) match case json"""{ "user": $x, "active": true }""" => println(x + " is active") case _ =>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4