假设我有以下配置:
{
“default-value”:5,
“some-seq”: [
{“some-other-value”:100},
{“foo”:”bar”},
{“some-other-value”:1500}
]
}
我希望它被解码为案例类:
case class Config(defaultValue: Int, someSeq: Seq[SomeInteger])
case class SomeInteger(someOtherValue: Int)
这样它就会创建 Config(5, Seq(SomeInteger(100), SomeInteger(5), SomeInteger(1500))) (第二个是 5,因为列表的第二个对象中没有其他值键)是有办法吗?