I have a data source which is saved as json format string. what I want to do is to read every json record as a case class ,I am using json4s as the parser. and use the extract method to get the case class.
my class is like this:
import org.json4s._
import org.json4s.JsonDSL._
import org.json4s.jackson.JsonMethods._
case class Order(
order_id: String,
buyer_id: String,
seller_id: Long,
price: Double
)
and the parsing code is:
file.map(parse(_).extract[Order])
but this is done out of the class, what I want is json string as a constructor function argument for class Order
but as far as I know, a case class constructor must use the default constructor.
so is there anyway to deal with this?