Changing Json Deserializer Settings

Hi all,

New to developing in RPA, got a question on syntax i need to use. I’m trying to deserialize an object I upload to a queue so I can use the datatable contained within (created a datatable, serialized it and uploaded to a queue). The usual "Deserialize JSON’ activities do not work unfortunately, as I sometimes have an empty “” in a column containing doubles, leading to the following error:

[ERROR] [UiPath.Studio.Shared.Logging.OutputLogger] [47] Assign Ticket DataTable: Error converting value “” to type ‘System.Double’. Path ‘[1].Serial’, line 1, position 179.

I tried checking for all empty strings and replacing them with a random string (e.g. “Empty”), but this increases processing time dramatically. Now I found that I can call some Newtonsoft code in an assign as follows;

JsonConvert.DeserializeObject(Of Datatable)(TransactionInfo(“LineItems”).ToString)

Where “LineItems” is the datatable, serialized and uploaded to a queue.
And then there is a property “Ignore Null Value Handling” that one should be able to set;

NullValueHandling = NullValueHandling.Ignore

Found from this stackoverflow. My question is, how do I incorporate that setting in my assign activity?

I tried several iterations of

JsonConvert.DeserializeObject(Of Datatable)(TransactionInfo(“LineItems”).ToString, NullValueHandling.Ignore)

But my knowledge is too limited to know the proper syntax to ignore the null values. Anyone that knows what the proper syntax is?

Thanks in advance

^ incorrect, as the “Empty” is also considerd a string and the deserializer does not agree with parsing doubles and strings in one column. Im assuming adding a 0 instead would work, but still increase processing time too much.

Hello,

I was able to include the settings doing like this :

1 - Start the variable which will be the JsonSerializerSettings

image

2 - Assign the the variable method JsonSettings.NullValueHandling the NullValueHandling.Ignore

image

3 - Deserialize using on settings the variable we set before

I hope it helps in the future,
Regards,
Diogo Nunes