This Scala 3 library provides set of extensions to the upickle library provided with Scala toolkit.
- Scala >= 3.3.5
- org.fusesource.jansi jansi 2.4.1
- com.lihaoyi upickle 4.1.0
Use with SBT
libraryDependencies += "org.encalmo" %% "upickle-utils" % "0.9.9"
or with SCALA-CLI
//> using dep org.encalmo::upickle-utils:0.9.9
import org.encalmo.utils.JsonUtils.*
case class Example(message: String) derives upickle.default.ReadWriter
val text = """{"message":"Hello World!"}"""
val text = """{"message":"Hello World!"}"""
val json: ujson.Value = text.readAsJson
val jsonOpt: Option[ujson.Value] = text.maybeReadAsJson
val example = text.readAs[Example]
val exampleOpt = text.maybeReadAs[Example]
├── .github
│ └── workflows
│ ├── pages.yaml
│ ├── release.yaml
│ └── test.yaml
│
├── .gitignore
├── .scalafmt.conf
├── JsonFormatter.scala
├── JsonUtils.scala
├── JsonUtilsSpec.test.scala
├── LICENSE
├── project.scala
├── README.md
└── test.sh