I have got a input string like "[key1:value1,key2:value2]", how to get the value by key?
Discussion posts and replies are publicly visible
liangl7510 , you can use the below code to convert you input string to a valid list of Map type variable and thn by using simple index function you can get the values based on the keys.
a!localVariables( local!input: substitute( substitute( "[key1:value1,key2:value2,key3:value3,key4:value4]", "[", "" ), "]", "" ), local!arrayOfText: split(local!input, ","), local!finalMap: a!flatten( a!forEach( items: local!arrayOfText, expression: a!localVariables( local!temp: split(fv!item, ":"), { a!map(key: local!temp[1], Value: local!temp[2]) } ) ) ), index( local!finalMap.Value, wherecontains("key1", local!finalMap.key), "" ) )