我有一个 JSON
{
"key": "processId-29231",
"fields": {
"attachment": [
{
"id": "79572",
"filename": "File1.png"
},
{
"id": "74620",
"filename": "File2.docx"
},
{
"id": "79072",
"filename": "File3.xlsx"
}
]
}
}
我需要将其重组为
{
"processId": "processId-29231",
"attachments": [
"https://example.com/files/79572/File1.png",
"https://example.com/files/79572/File2.docx",
"https://example.com/files/79572/File1.xlsx",
]
}
我可以使用特定的数组索引来完成这项工作
{processID:key,attachments:join('',['https://example.com/files/',fields.attachment[1].id,'/',fields.attachment[1].filename])}
产生这个结果
{
"processID": "processId-29231",
"attachments": "https://example.com/files/74620/File2.docx"
}
我在没有数组索引的情况下尝试了两种方式
这
{processID:key,attachments:join('',['https://example.com/',fields.attachment[].id,'/',fields.attachment[].filename])}
还有这个
{processID:key,attachments:join('', ['https://example.com/',fields.attachment[*].id,'/',fields.attachment[*].filename])}
但这并没有帮助。
关于如何解决这个问题的任何提示?