【发布时间】:2016-09-23 12:06:18
【问题描述】:
现在的输出是:
{
"Product_Type":
"[{\"active\":true,\"description\":\"ALL IN ONES\",\"id\":2},
{\"active\":true,\"description\":\"ACCESSORIES\",\"id\":1}]",
"Product_Brand":
"[{\"active\":false,\"brand\":\"101 DALMATIANS\",\"id\":1}]"
}
预期是:
{
"Product_Type":
[{"active":true,"description":"ALL IN ONES","id":2},
{"active":true,"description":"ACCESSORIES","id":1}],
"Product_Brand":
[{"active":false,"brand":"101 DALMATIANS","id":1}]"
}
我有以下返回 json 数据的 api 代码。
Code:
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("brand")
public String getProductBrand() {
return attributeMasterService.getProductBrand() +
attributeMasterService.getProductType();
}
输出:
[{"active":false,"brand":"101 DALMATIANS","id":1}]
[{"active":true,"description":"ACCESSORIES","id":1},
{"active":true,"description":"ALL IN ONES","id":2}]
我需要帮助以获取下面提到的格式的数据。
基本上我需要将文档名称附加到数组中。
[
Product_Brand:
[ {"active":false,"brand":"101 DALMATIANS","id":1}],
Product_Type:
[ {"active":true,"description":"ALL IN ONES","id":2},
{"active":true,"description":"ACCESSORIES","id":1}]
]
您能帮我构建上述结果吗?
谢谢,
【问题讨论】: