Arrays 颠簸转换:如何将一些值转移到列表中的每个映射中
从昨天开始,我一直在进行Jolt转换,无法找到实现以下输出的解决方案。Arrays 颠簸转换:如何将一些值转移到列表中的每个映射中,arrays,json,dictionary,transform,jolt,Arrays,Json,Dictionary,Transform,Jolt,从昨天开始,我一直在进行Jolt转换,无法找到实现以下输出的解决方案。 我想在“记录”列表的每个地图(字典)中插入“年”、“月”、“日” 输入 [{"root": {"body": {"year":2019, "month":8, "day":9, "records":[ {"user":"a", "item":"x", "price":300, "count":1}, {"u
我想在“记录”列表的每个地图(字典)中插入“年”、“月”、“日” 输入
[{"root":
{"body":
{"year":2019,
"month":8,
"day":9,
"records":[
{"user":"a",
"item":"x",
"price":300,
"count":1},
{"user":"b",
"item":"y",
"price":100,
"count":3}]
}
}
}]
所需输出
[{"user":"a",
"item":"x",
"price":300,
"count":1,
"year":2019,
"month":8,
"day":9},
{"user":"b",
"item":"y",
"price":100,
"count":3,
"year":2019,
"month":8,
"day":9}
]
我可以将“年”、“月”、“日”的值作为{“记录”:[[2019,8,9]、{map1}、{map2}]等列表插入每个地图的外部,但这不是我想要的。谢谢你的帮助和建议。并提前向您表示感谢。这应该可以满足您的要求: 解决方案(在线解释): 输出:
[
{
"user": "a",
"item": "x",
"price": 300,
"count": 1,
"year": 2019,
"month": 8,
"day": 9
},
{
"user": "b",
"item": "y",
"price": 100,
"count": 3,
"year": 2019,
"month": 8,
"day": 9
}
]
这应该满足您的要求: 解决方案(在线解释): 输出:
[
{
"user": "a",
"item": "x",
"price": 300,
"count": 1,
"year": 2019,
"month": 8,
"day": 9
},
{
"user": "b",
"item": "y",
"price": 100,
"count": 3,
"year": 2019,
"month": 8,
"day": 9
}
]