给定这样的结构:
{
"nameOfObject": { "score": 100 },
"anotherObject": { "score": 30 }
}
能否将此映射为:
class Container {
Map<String, ScoreKeeper> scoreKeepers;
}
class ScoreKeeper {
String name;
int score;
}
你希望让ScoreKeeper
实例的name
属性分别设置为"nameOfObject"
和"anotherObject"
,是吗?