我从Jolt开始,但是我无法将数组的元素连接为单个字符串
我有这样的json:
{
"partNb": "1234",
"partDescriptions": [
{
"country": "GB",
"language": "en",
"content": "1 tool description in en_GB"
},
{
"country": "GB",
"language": "en",
"content": "2 tool description in en_GB"
}
]
}
并具有震撼力规格:
[
{
"operation": "shift",
"spec": {
"partNb": "id",
"partDescriptions": {
"*": {
"content": "description"
}
}
}
}
]
为此,我有以下输出:
{
"id" : "1234",
"description" : [ "1 tool description in en_GB", "2 tool description in en_GB" ]
}
但是如何获得这样的结果?:
{
"id" : "1234",
"description" : "1 tool description in en_GB , 2 tool description in en_GB"
}
答案 0 :(得分:0)
规范
[
{
"operation": "modify-overwrite-beta",
"spec": {
"description": "=join(', ',@(1,description))"
}
}
]
答案 1 :(得分:0)
要仅获取连接到描述中的内容字段:
@Path("/")
@Api("/")
@Service
public interface IService {
@GET
@Path("/health")
@ApiOperation("/health")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Status getStatus();
@GET
@Path("/info")
@ApiOperation("/info")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Info getInfo();
}
输出:
#cxf url mapping
cxf.path=/api
cxf.jaxrs.component-scan=true
cxf.jaxrs.classes-scan-packages=com,org.apache.cxf.jaxrs.swagger.Swagger2Feature,org.codehaus.jackson.jaxrs,org.apache.cxf.jaxrs.swagger.ui.SwaggerUiResourceLocator
#port
server.port=8000
server.servlet.context-path=/