JensDeveloper
4 years agoContributor II
Change array to object and extract certain characters from it
Hi,
I am trying to change the array to an object and after that only get the value between the ()
Example:
Input
[
{
“Systems” : [“Ardoq (431)”, “SnapLogic (780)”]
}
{
“Systems” : [“SnapLogic (780)”]
}
]
Expected output:
[
{
“Systems” : “431”,
“Systems” : “780”
}
{
“Systems” : “780”
}
]
Pipeline is below with the transformation I already tried with toObject…
get_valuesFromArray_2022_07_11.slp (6.2 KB)
And I tried also this replace transformation from my last topic: Map expression regex - #6 by JensDeveloper and then change it to ‘(’ to extract the character afther the ‘(’
Regards
Jens
Hi,
Use the below expression in a mapper. After that use the Splitter snap to get the details.
$Systems.map(x => {“Systems” : x.substring(x.indexOf(“(”)+1, x.indexOf(“)”))})