Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
コード スニペットREPL
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"}
出力では、、、の代わり_1に属性にラベルを割り当てたいと思います。どうすればこれを行うことができますか?_2_3
_1
_2
_3
case classタプルの代わりに a を使用します。
case class
case class Named(myInt: Int, thisDouble: Double, desc: String) generate(Named(1, 3.14, "Fred"))
与えます:
{"myInt": 1.0,"thisDouble":3.14,"desc":"Fred"}