public class X {
Header property1;
NeedHelp property2;
Sections property3;
}
示例json
{
header: {
name: "Test",
description: "Description"
},
needHelp: {
deckNumber: "deck Number"
},
sections:
{
media: {
type: "image"
}
}
}
应为json
{
header: {
name: "Test",
description: "Description"
},
needHelp: {
deckNumber: "deck Number"
},
sections:
{
media: {
type: "image"
}
}
或
{
header: {
name: "Test",
description: "Description"
},
sections:
{
media: {
type: "image"
}
},
needHelp: {
deckNumber: "deck Number"
}
或
{
needHelp: {
deckNumber: "deck Number"
},
header: {
name: "Test",
description: "Description"
},
sections:
{
media: {
type: "image"
}
}
}
实际响应
{
header: {
name: "Test",
description: "Description"
},
needHelp: {
deckNumber: "deck Number"
},
sections:
{
media: {
type: "image"
}
}
}
我试着看看 @JsonPropertyOrder
,但这更多的是静态顺序。当我将这个pojo转换为json时,它应该保留属性顺序。。即一次我可以收到物业2,物业3,物业1,下次我回来物业1,物业2,物业3。
最终的json应该保留这个顺序。
暂无答案!
目前还没有任何答案,快来回答吧!