Hi all.
I want to pass variables dynamically into JSON string,but i’m getting an error saying input string was not in correct format though all variables are in type string. Following is the JSON string,
“Ref”: [
{
“Entity”: {
“type”: “{0}”,
“value”: “{1}”
}
}
]
Someone please suggest how to pass values.
Thanks in advance.
Fine if this is in a string format like this string is saved in a text file (.txt)
–then we can use read text file activity and get the output with a variable of type string
named str_text
–now use a assign activity like this str_text = String.Format(str_text,“yourvalue1”,“yourvalue2”)
so these value1 and value2 will get replaced in the place holder {0},{1},{2},…
yes @Shree_Vybhavi
String.Format wont work because this method look for instances of curly braces with digit/s like {0},{1} etc to replace it with desired value…
As in our case we are using Json String, it is failing…
There is still way to do it with String.format… but it is not feasible
all you have to do is escape curly braces by doubling it like below