How does JSON to case class derivation work in Scala?

168 Views Asked by At
case class Person(name: String, age: Int)
json.parseTo[Person]("""{"name": "Bob", "age", 30}""")

E.g. as in argonaut-shapeless. How does this work?

I was interested in applying the same principle towards representing the input of a Spark job. E.g. given

case class RecordsDatabase(
  people: Dataset[Person]
  accounts: Dataset[Account]
)

I was looking to do away with the boilerplate of writing

RecordsDatabase(
  spark.table("people").as,
  spark.table("accounts").as
)
0

There are 0 best solutions below