UiPath Activity fails with JSON deserialize error

How to fix any of the following errors thrown by UiPath Activities? "Deserialize JSON: Cannot create and populate list type Newtonsoft.Json.Linq.JToken. Path 'List', line 1, position 102." or "Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'Newtonsoft.Json.Linq.JToken' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly."

Issue Description:
This issue happens because of a sub-dependency conflict (Newtonsoft.json) between the installed dependency packages.


Resolution:

  1. Expand the installed activity packages to see their sub-dependencies.
  2. Identify the ones using Newtonsoft.Json and check their versions.
  3. If the versions of the Newtonsoft.Json sub-dependency do not match, upgrade or downgrade either of the activity packages so the version of the Newtonsoft.Json sub-dependency matches.
1 Like

This is more of a bug with the Deserialize activity from UiPath I find.

If you remove that activity and instead just invoke the NewtonSoft code directly it won’t bug out.

For example put this in the right side of an assign activity.

Newtonsoft.Json.JsonConvert.DeserializeObject(Of JObject)(variableName)

Obviously change the object type and variable name accordingly.

3 Likes

A post was split to a new topic: Is there a package to Serialize JSON?

A post was split to a new topic: “Deserialize JSON: Cannot create and populate list type Newtonsoft.Json.Linq.JToken. Path ‘List’, line 1, position 102.” ? after updating Gsuite.Activities