A JSON string:
{
"name": "Mike",
"age": 111
}
A case class:
case class User(name:String, age:Int)
If I use scala, there are many libraries can let me convert the JSON to the case class and vice versa, but they can't be used in scala.js.
How to do this work in scala.js?
Use one of the pickling libraries that work with Scala.js. The following two produce well-behaved and predictable JSON:
Circe
has more than 1000 stars:
https://github.com/circe/circe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With