Open Ankitsurparia opened 2 years ago
Hi @milosimpson
I need some help, if a String contains a comma-separated value can be converted into the array of object For Example :
{ "requestObject": [ { "ServiceID": "Small Barqs-1,Small Barqs-2", "description": "Test Description - 1" }, { "ServiceID": "Mozzz-1,Mozzz-2", "description": "Test Description - 2" }, { "ServiceID": "Mozzz-3", "description": "Test Description - 3" } ] }
Expected Output:
{ "temp": [ { "cptCode": "Small Barqs-1", "description": "Test Description - 1" }, { "cptCode": "Small Barqs-2", "description": "Test Description - 1" }, { "cptCode": "Mozzz-1", "description": "Test Description - 2" }, { "cptCode": "Mozzz-2", "description": "Test Description - 2" }, { "cptCode": "Mozzz-3", "description": "Test Description - 3" } ] }
Spec Mapping : [ { "spec": { "requestObject": { "*": { "ServiceID": "=split(',',@(1,ServiceID))" } } }, "operation": "modify-overwrite-beta" }, { "operation": "shift", "spec": { "requestObject": { "*": { "ServiceID": { "*": { "@": "temp[&1].code" } } } } } } ]
[ { "spec": { "requestObject": { "*": { "ServiceID": "=split(',',@(1,ServiceID))" } } }, "operation": "modify-overwrite-beta" }, { "operation": "shift", "spec": { "requestObject": { "*": { "ServiceID": { "*": { "@": "temp[&1].code" } } } } } } ]
I need a way to generate expected out.
Thanks Ankit
Hi @milosimpson
I need some help, if a String contains a comma-separated value can be converted into the array of object For Example :
{ "requestObject": [ { "ServiceID": "Small Barqs-1,Small Barqs-2", "description": "Test Description - 1" }, { "ServiceID": "Mozzz-1,Mozzz-2", "description": "Test Description - 2" }, { "ServiceID": "Mozzz-3", "description": "Test Description - 3" } ] }
Expected Output:
{ "temp": [ { "cptCode": "Small Barqs-1", "description": "Test Description - 1" }, { "cptCode": "Small Barqs-2", "description": "Test Description - 1" }, { "cptCode": "Mozzz-1", "description": "Test Description - 2" }, { "cptCode": "Mozzz-2", "description": "Test Description - 2" }, { "cptCode": "Mozzz-3", "description": "Test Description - 3" } ] }
Spec Mapping :
[ { "spec": { "requestObject": { "*": { "ServiceID": "=split(',',@(1,ServiceID))" } } }, "operation": "modify-overwrite-beta" }, { "operation": "shift", "spec": { "requestObject": { "*": { "ServiceID": { "*": { "@": "temp[&1].code" } } } } } } ]
I need a way to generate expected out.
Thanks Ankit