Code snippet in REPL
scala> import com.codahale.jerkson.Json._
scala> val t = (1, 3.14, "Fred")
scala> generate(t)
res5: String = {"_1":1,"_2":3.14,"_3":"Fred"}
In the output, I want to assign labels to attributes instead of _1, _2, _3. How would I go about doing this?
Use a
case classinstead of a tuple:Gives: