Create string with json content

Hi,

I’m using assign activity where I need to assign json to string variable.

Json:
{
“query”: “{
stop(id: “xxx:11722223”) {
name
lat
lon
}”
}

Especially stop row gives me troubles and seems that I cannot format string correctly. Have tried multiple times, here is one attemp.

In assign activity:
“{query:{Stop(id:‘xxx:11722223’){name lat lon}}”

In debug UiPath sees above:
“{query:{Stop(id:\‘xxx:11722223\’){name lat lon}}”

Heard that one solution would be to create json object and turn that to string, but not sure how to do that.

@jouni.riimala Can you provide Screenshots of what you have done in the Workflow design with the type of the variables shown?

Hi,

Question was just how to modify that json content into string so one assign activity… However learned how to create json object from string so issue solved. Seems that by creating json object string is formated directly to correct format.

image

1 Like

@jouni.riimala
for developing a JSON string it helps to get it validated via an online validator eg:

Actually, above I stated that problem was fixed (by me) and don’t get it why you didn’t understand issue. So didn’t except any more replies…

Did miss however to mark solution resolved, now done. Additionally JSONLint is good point overall (have used it though). Naturally it’s also good practice to use scr shots or even xaml - files…

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