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
can someone help me understand the error here.
Discussion posts and replies are publicly visible
Hi Teja,
It is because you are using "" multiple times in the string that you have used in substitute() function,
If you will modify your text parameter like the below one. Then it works fine
substitute("param:[{key1:value1,key2:value2}, {key3:value3,key4:value4}]","["," ")
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"}]"),"["," ")
Tried it No Good result vivek. it is returning null.
your input string still isn't formatted properly. the proper way to create double-quotes inside an Appian string is to put 2 sets of double quotes. this added to needing single-quotes surrounding your string. it gets pretty confusing. you might try inserting your desired string value as the "value" portion of an input parameter and seeing what happens then.
as far as i can tell, this should work:
local!string: """param"":[{""key1"":""value1"",""key2"":""value2""}, {""key3"":""value3"",""key4"":""value4""}]"
actually tried that it didn't work
seems to work for me - remember you need to enclose your local variable in with() or load() or a!localVariables() which it looks like you may have missed. here's my result:
and here's my code:
with( local!string: local!string: """param"":[{""key1"":""value1"",""key2"":""value2""}, {""key3"":""value3"",""key4"":""value4""}]", substitute(local!string, "[", " ") )
Hey Teja,
Lets do this, As far as I can understand you are receiving a json text and from that you want to blank out the "[". Is it so? If yes then can you please tell us the exact use case which you want to achieve ? Because instead of doing this hard cord logic, We can go for other functions that will help you to extract Json values.
This was the use case i was working on vivek
community.appian.com/.../nested-json-via-integration-object-on-to-a-paging-grid-error