输入是
{
"Id": ["A1", "A2", "A3"],
"isAvailable": true,
"isActive": true
}
输出应如下所示
{
"Id": "A1",
"isAvailable": true,
"isActive": true
},
{
"Id": "A2",
"isAvailable": true,
"isActive": true
},
{
"Id": "A3",
"isAvailable": true,
"isActive": true
}
我尝试了以下代码,但遇到了问题,请帮帮我,我尝试了json Builder,但不起作用
def input = new JsonSlurper().parseText(inputfile);
for (int i = 0; i < id.size(); i++){
def output = {
id: id[i]
isAvailable: input.isAvailable
isActive: input.isActive
}
}
1条答案
按热度按时间s3fp2yjn1#
简单的收集可以做到: