How to initialize a JSON string in UIPath?

I am trying to initialize a JSON string that is to be deserialized as a JObject:

"{\n  \"running\": false,\n  \"params\": [\n    { \"href\": \"https://github.com/sedhha\", \"uri\": \"github\" },\n    {\n      \"href\": \"https://stackoverflow.com/users/8176451/shivam-sahil\",\n      \"uri\": \"stackoverflow\"\n    },\n    { \"href\": \"https://devpost.com/sedhha/\", \"uri\": \"devpost\" }\n  ]\n}"

When I try to assign a string variable, since json string already consists of " I can’t use it again to initialize my JSON string. Can anyone tell me a right way to initialize JSON string in UIPath?

1 Like

string.empty should help.

#nK

I think you misunderstood me, I want to initialize the string with the value I showed above. In other programming languages one can use single quotes to wrap the entire string into that but not sure how to do it in vb.net. My end goal is do something like this:

newString = 
"{\n  \"running\": false,\n  \"params\": [\n    { \"href\": \"https://github.com/sedhha\", \"uri\": \"github\" },\n    {\n      \"href\": \"https://stackoverflow.com/users/8176451/shivam-sahil\",\n      \"uri\": \"stackoverflow\"\n    },\n    { \"href\": \"https://devpost.com/sedhha/\", \"uri\": \"devpost\" }\n  ]\n}"
1 Like

Clear now.

After first double quotes, just use “” two times wherever it is required.

" Is the escape character here.

Hope this helps.

#nK

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.