【发布时间】:2019-08-06 09:37:03
【问题描述】:
如何序列化该对象。但只有对象 anotherObject 的字段,但 json 中没有“anotherObject”键
class A{
int some = 1;
B anotherObject = new B();
}
class B{
int someB = 2;
}
我需要下一个 JSON 作为序列化结果
{
"A":{
some: 1,
anotherSome: 2
}
}
【问题讨论】:
-
您能否详细说明 anotherObject 与 anotherSome?