Question regarding the downgraded functionality of the Deserialize JSON activity

Hello,

previously my team had built a custom Initialization process using a JSON Config file. This file was a Complex JSON structure that contained sections for development, QA, Prod, and Global variables. In the past, the “Deserialize JSON” activity had no issue in regards to this structure, it could read and deserialize it into a JOBject. Now that we’ve upgraded our UiPath.UiAutomation.Activites package, the functionality of that activity seems to have taken a step back. It not only handles simple JSON structures. Has anyone had this issue or are they able to provide a solution for this problem? Below is an example of the JSON Structure we were able to deserialize before.

{
  "GLOBAL":{
    "DEBUG":"FALSE",
    "ProcessCleanup":["chrome.exe","iexplore.exe","firefox.exe","excel.exe","calculator.exe","notepad.exe","winword.exe"],
    "Environment":"",
    "ShortRun":"FALSE",
    "ShortRunCount":50,

    "NoteTopic":"TOPIC",
    "NoteText":"NOTE TEXT",

    "CCURL":"",
    "CCCredentials":"Robot Account 00002 CC",
  
    "ReportLogRoot":"FILEPATH",

    "EmailReporting":"True",
    "EmailTo":"email",
    "EmailCC":"",
    "EmailSubject":"Process Complete",

    "ProcessID":"#",

  },
  "LOCAL":{
    "EmailReporting":"True",
    "EmailTo":"email",
    "EmailCC":"",
    "EmailSubject":"Process Complete",

    "CCURLAsset":"CC_URL_Prodsup",
    "CCURL":"CC_URL_Prodsup",
  },
  "DEV":{
    "EmailReporting":"True",
    "EmailTo":"email",
    "EmailCC":"",
    "EmailSubject":"Process Complete",

    "CCURLAsset":"CC_URL_Prodsup",
    "CCURL":"CC_URL_Prodsup",
  },
  "STAGE":{
    "EmailReporting":"True",
    "EmailTo":"email",
    "EmailCC":"",
    "EmailSubject":"Process Complete",

    "CCURLAsset":"CC_URL_Prodsup",
    "CCURL":"CC_URL_Prodsup",
  },
  "PROD":{
    "EmailReporting":"True",
    "EmailTo":"emailList",
    "EmailCC":"emailList",
    "EmailSubject":"Process Complete",

    "CCURLAsset":"CC_URL",
    "CCURL":"CC_URL",
}

We crosschecked with new Package Version Levels and do not face irregularities so far

Maybe you can elaborate more on the issues, what was modelled and the used Package versions

I know it’s not really an answer to your question, but it’s simpler to have separate config files for QA and prod - and use an Asset in each environment to control where the robot looks for the config file. So in QA you have a config file with an Asset that points to it, and in prod you have a separate config file and the Asset has the prod config file path and filename.

As for global variables, those should be in Assets.

The issue seems to be when using packages that cause the Newtonsoft.Json package to upgrade to 13.x+, when kept at 11.0.2 it seems to not encounter the issue. The error we see is this:

Deserialize JSON: 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.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'GLOBAL.DEBUG', line 3, position 12.

Note, using Deserialize JSON Array doesn’t work in this case either.

Am I missing something obvious here with the part that says:

JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.

As shown above in the feedback, deseralization was working
Provided JSON is a JObject

we tested also against ProcessCleanup JArray and did handle it correctly.

Maybe you share the details or your XAML with us