Deserialize Activity - problem

Hi everyone, I’m trying to deserialize json like:

[{“System”:{“CSR”:“PEA”}},{“System SAC”:{“SAC”:“CC BB WW”}}]

which is valid json format. When I try to use Deserialize JSON activity comming from UiPath.WebAPI.Activities ver 1.13.2 I have an error:

Deserialize JSON: Deserialized JSON type ‘Newtonsoft.Json.Linq.JArray’ is not compatible with expected type ‘Newtonsoft.Json.Linq.JObject’. Path ‘’, line 1, position 61.

What is wrong ?

Hi
I had the same error in the same activity.
In my case problem was in Newtonsoft.Json package.
This error appear for Newtonsoft.Json > 13. If you are able to downgrade this dependency to 11.x it should solve this issue.

So there is nothing wrong with NewtonSoft version 13. Its a bug with the UiPath activity which, frankly, really isn’t needed as this is a single line operation.

Just have an assign activity and place the folllowing code in it.

C#
Newtonsoft.Json.JsonConvert.DeserializeObject(@“[{”“System”“:{”“CSR”“:”“PEA”“}},{”“System SAC”“:{”“SAC”“:”“CC BB WW”“}}]”)

VB.net
Newtonsoft.Json.JsonConvert.DeserializeObject(of JArray)(“[{”“System”“:{”“CSR”“:”“PEA”“}},{”“System SAC”“:{”“SAC”“:”“CC BB WW”“}}]”)

This is something I posted on the official UiPath response too, for reference.

2 Likes

@jkurnik Welcome to UiPath Community

How to use it? Where to past this function?

See my instructions as above.

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