Substitute function string issue

i wish to replace/substitute "[", "]" with " " in string received below

""param":[{"key1":"value1","key2":"value2"}, {"key3":"value3","key4":"value4"}]"

substitute(""param":[{"key1":"value1","key2":"value2"}, {"key3":"value3","key4":"value4"}]","["," ")

substitute(""param":[{"key1":"value1","key2":"value2"}, {"key3":"value3","key4":"value4"}]","]"," ")

I am receiving the below error

Expression evaluation error at function 'substitute': Signature length (4) does not match parameter length (12)

can someone help me understand the error here.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    Each and every item under " " is considered as a separate string. That's why you are getting error which says signature length does not match. 

    One more thing you can do here is to convert your parameter into string first, Like below

    substitute(tostring(""param":[{"key1":"value1","key2":"value2"}, {"key3":"value3","key4":"value4"}]"),"["," ")

Reply
  • 0
    Certified Associate Developer

    Each and every item under " " is considered as a separate string. That's why you are getting error which says signature length does not match. 

    One more thing you can do here is to convert your parameter into string first, Like below

    substitute(tostring(""param":[{"key1":"value1","key2":"value2"}, {"key3":"value3","key4":"value4"}]"),"["," ")

Children