I have a JSON object:
{
"Data": "{field1: [x,y],field2: z}"
}
Desired Output JSON:
{
"field3": "z"
}
[
{
"operation": "shift",
"spec": {
"Data": {
"*field2:*}*": {
"$(0,2)": "field3"
}
}
}
}
]
Here the value of "Data"
is a complete string not a JSON, hence I have to break it into wildcards and now the 2nd '*'
in the spec gives me the value "z"
.
Is there any better approach to do the same such that say a new field comes before or after field2 then I don't have to modify this regex.