I am trying to format a Json input to a JSON RPC. For example, the JSON am goint to post is as following,
"{"filter":{ "Ids": [123, 124], "Types":["EMPLOYEE"]}}"
which I expect to return users with id 123, 124 and of type EMPLOYEE. But for the Ids parameter, I want to may it dynamic so that I can set the value in my C# calling method like the following
string.Format("{\"filter\":{ \"Ids\": [{0}], \"Types\":[\"EMPLOYEE\"]}}", "123, 124");
when doing so, I get the format exception "Input string was not in correct format"....
I know, I can build up the string using string.concat or string builder. Am just curious, if there is any solution to overcome this string.format exception in the event when a string has curly brackets (am assuming this is the cause of the exception) already.
{needs to be escaped if you want to use it literally.