I'm looking at the code of "Akka and Spray" tutorial in Typesafe's Activator, written by eigengo. I do not get where jsonFormat1, jsonFormat2, ... jsonFormatN is defined and how it does what it does.
implicit val sendMessageFormat = jsonFormat2(SendMessage)
The above snippet is in scala > api > MessengerService.scala
Thank you.
Basically, the N
in jsonFormatN
denotes the number of parameters of the class that you are trying to Marshall/Unmarshall.
An excerpt from the link posted by Ashalynd:
The jsonFormatX methods reduce the boilerplate to a minimum, just pass the right one the companion object of your case class and it will return a ready-to-use JsonFormat for your type (the right one is the one matching the number of arguments to your case class constructor, e.g. if your case class has 13 fields you need to use the jsonFormat13 method).
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