UiPath adding additional backslashes in output argument to API call for json object

Hi all,

I am using an API to trigger my robot (with {url}/odata/Jobs/UiPath.Server.Configuration.OData.StartJobs). The API gives the robot a few input arguments. These arguments are subsequently entered into a SAP system, and a datatable is given which I scrape.

I convert the datatable to a json string using the assign activity: jsonOutput = JsonConvert.SerializeObject(dt). When using the log message activity, I get the following output message in UiPath Studio:

[{"Product":"2402427","Quantity":"1233","Unit":"EA","Description":"XXX","ShipFrom":"XXX","Available":"1.233","On":"05.11.2021"},{"Product":"2402427","Quantity":"32","Unit":"EA","Description":"XXX","ShipFrom":"XXX","Available":"32","On":"05.11.2021"},{"Product":"2402427","Quantity":"235","Unit":"EA","Description":"XXX","ShipFrom":"XXX","Available":"BO","On":""}]",

This format is perfect for what I need. However, when I have this as an output argument for the automation in UiPath Studio, this is what I receive in the API (in Postman):

As you can see, every backslash becomes three instead. All I want is for the output to be in the same format as the UiPath gives off as a message. Does anyone have a resolution to this?

Any help is highly appreciated, many thanks!

Did you try removing the backslashes before doing the API call?

Hmm I’m not sure I understand what you mean.

However, it seems like I managed to resolve the issue! I used the deserialize option to convert the string into a Json Array, see picture below:

Sorry it might have been a very basic question, I am quite new to working with json.

I hope this is helpful for anyone else reading this!

Lets keep one thing in mind. Visual OutPutse.g. from log console / debug tools like immediate panel can visualize strings withc characters, which woll not be within the string
grafik
grafik

So lets follow the chain and see where it is to adopt.

We do know a valid JSON would be like this:
{"strPropName1": "strPropValue1",strPropName2": "strPropValue2"}
we do need the quotes for the string values

It can be visualized different. And as you had done (while this answer was written) we just check:

  • no over quotings while multiple escapings
  • correct serializations / deserializations
1 Like

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