当前输出
"some-details":
[
"{detail-1={date=17/04/2017}, subdetails=[]}",
"{detail-2={date=17/04/2017}, subdetails=[{subdetail1=ABC}, {subdetail2=DEF}]}"
]
某些细节的值被视为对象为地图的列表
我们正在使用jersey服务器,并且已经在某些细节上使用了@xmlElement,关键字细节中的细节不能有pojo,因为它是动态的。
预期输出
"some-details":
[
"detail-1":{ "date" = "17/04/2017" }, "subdetails" : []}",
"detail-2":{"date":"17/04/2017"}, "subdetails"= ["subdetail1" : "ABC",
"subdetail2" : "DEF"
]}
]
任何人都可以帮忙解决这个问题。可以尝试其他替代方案
项目依赖项:
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>${jaxrs.version}</version>
</dependency>
<!-- Jersey 2.19 -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>${jersey2.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey2.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>${jersey2.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>