【发布时间】:2023-01-12 06:10:37
【问题描述】:
如何遍历列表并替换其中的一些元素? 我有这个输入
{
"clients": [
{
"clientId": "166734",
"info": {
"cards": [
"378282246310005",
"371449635398431"
]
}
}
]
}
我希望卡片看起来像这样"cards" : [ "3782", "3714" ]
但在我的规范中,子字符串不起作用
[
{
"operation": "modify-overwrite-beta",
"spec": {
"clients": {
"*": {
"info": {
"cards": {
"*": "=substring(@(1,&),0,@(1,4))"
}
}
}
}
}
}
]
【问题讨论】: