How to convert a DataTable to a JSON string in UiPath

preview_player
Показать описание
This video guide shows, hot to convert a DataTable to a JSON string (= serialize object).

🔔Subscribe if you enjoyed

🤖UiPath Advanced Tutorial

#uipath #rpa #tutorial
Рекомендации по теме
Комментарии
Автор

Hey Anders! I have stumbled across your videos from time to time over the years and appreciate all the work you do. I tend to usually make dt to JSON conversions using jObjects with jObject.FromObject(), but this is a quick and easy way that I really love. I did want to point out one thing. You named the variable jsonConvert, which is the name of the JsonConvert Class. I don't believe this will work as well using a variable named anything else because your variable is 'inheriting' the keyword of the JsonConvert Class more or less (e.g. using var JConv Of type JsonConvert will not yield the same properties and methods as using the jsonConvert class in the Intellisense, and there will be no SerializeObject() method; you may be able to manually type the script). Instead of creating the var, you could just use the JsonConvert Class directly and it will populate the desired methods.

As always, appreciate the videos and the work you do!

gunthergreatnis
Автор

I can't believe you watched this and thought.... yeah lets put my face and next video over the output of the subject. 0.0

ALLKINDZASHT
Автор

This helped a lot, but because of the links to the next videos we can't actually see the serialized datatable in the output.

Edit: Actually after doing exactly what is in the video, I get a validation error on the Assign activity telling me that "Type 'JsonConvert' is not defined." It's definitely possible I don't understand how a JsonConvert object is used, but in your video you don't assign anything to it and you simply use it.

For the record, I have Newtonsoft.Json 11.0.2 as a dependency and was able to find the variable type easily so I don't think it's an issue like that.

justinkaminski
Автор

Hey when I try this as you mentioned in the video, numbers gets like 1.0 or 3.0 I would want to write it like 1 or 3 as a string format how can I do that?

kynos