Namespace "Newtonsoft.Json" cannot be resolved

Hi, everyone:

I’m having trouble with the package “UiPath.WebAPI.Activities” and the namespaces Newtonsoft.Json and Newtonsoft.Json.Linq.

The package version is 1.11.0 and the UiPath Studio version is 2021.4.6

In the Imported Namespaces panel, I’m getting the following error:

So far, I’ve tried two different approaches and none of them have solved the issue:

  • Downgrade the version package
  • Restore to a previous version of the project

As a result of the above, I cannot use any of the activities contained in the package because the required variable types are not included in the project, for instance, Newtonsoft.Json.Linq.Jarray is nowhere to be found

Upgrading the UiPath Studio IS NOT feasible at the moment.

I honestly don’t know what else to do.

Hi @Centro_Excelencia_Operaci

Make sure the package you are using i.e UiPath.WebAPI.Activities is compatible with the studio version 2021.4.6.

Try updating your package to the latest version by keeping Runtime Rule as Lowest As Applicable and update your package. This might solve your error.

Regards

Hi @Centro_Excelencia_Operaci,

Is this due to two Newtonsoft.Json have been imported. I would suggest, Remove the Newtonsoft.Json.Linq and keep only Newtonsoft.Json and reload your project.

[Note- Make sure you have kept (UiPath Web Activity) package to lower version not strict]

Hope it will be helpful !!

Thanks in advance,
Jayavignesh G

Thank you for your response !

I was able to execute the code without any issues after updating the package. However, the error message in the Imported namespaces panel persists. Following @Jayavignesh_G’s suggestion, I deleted the Newtonsoft.Json.Linq and reloaded the project, but this did not seem to resolve the error. I prefer to address this issue promptly, even though the code can currently be executed. This is important to prevent potential future problems. Considering that this error is within a large Main project file, I would rather not take any chances.

Below I add the assembly references and namespaces inside the Main file:

<Activity mc:Ignorable="sap sap2010" x:Class="Main" mva:VisualBasic.Settings="{x:Null}" sap:VirtualizedContainerService.HintSize="1038,1009" sap2010:WorkflowViewState.IdRef="ActivityBuilder_1" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:snm="clr-namespace:System.Net.Mail;assembly=System" xmlns:ui="http://schemas.uipath.com/workflow/activities" xmlns:uwa="clr-namespace:UiPathTeam.WhatsGoingOn.Activities;assembly=UiPathTeam.WhatsGoingOn.Activities" xmlns:uwu="clr-namespace:UiPathTeam.WorkModule.Utilities;assembly=UiPathTeam.WorkModule.Activities" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <TextExpression.NamespacesForImplementation>
    <scg:List x:TypeArguments="x:String" Capacity="60">
      <x:String>System.Activities</x:String>
      <x:String>System.Activities.Statements</x:String>
      <x:String>System.Activities.Expressions</x:String>
      <x:String>System.Activities.Validation</x:String>
      <x:String>System.Activities.XamlIntegration</x:String>
      <x:String>Microsoft.VisualBasic</x:String>
      <x:String>Microsoft.VisualBasic.Activities</x:String>
      <x:String>System</x:String>
      <x:String>System.Collections</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Diagnostics</x:String>
      <x:String>System.Drawing</x:String>
      <x:String>System.IO</x:String>
      <x:String>System.Linq</x:String>
      <x:String>System.Net.Mail</x:String>
      <x:String>System.Xml</x:String>
      <x:String>System.Xml.Linq</x:String>
      <x:String>UiPath.Core</x:String>
      <x:String>UiPath.Core.Activities</x:String>
      <x:String>System.Windows.Markup</x:String>
      <x:String>System.Security</x:String>
      <x:String>UiPathTeam.WorkModule.Utilities</x:String>
      <x:String>UiPath.Excel</x:String>
      <x:String>System.Xml.Serialization</x:String>
      <x:String>System.Text.RegularExpressions</x:String>
      <x:String>Newtonsoft.Json</x:String>
      <x:String>Microsoft.VisualBasic.CompilerServices</x:String>
      <x:String>System.Runtime.Serialization</x:String>
      <x:String>UiPath.Activities.Presentation.Editors</x:String>
      <x:String>UiPath.Web.Activities.Design</x:String>
      <x:String>UiPath.Web.Activities.Design.Properties</x:String>
      <x:String>UiPath.Web.Activities</x:String>
      <x:String>UiPath.Web.Activities.Utils</x:String>
      <x:String>UiPath.Web.Activities.Properties</x:String>
    </scg:List>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <scg:List x:TypeArguments="AssemblyReference" Capacity="66">
      <AssemblyReference>PresentationFramework</AssemblyReference>
      <AssemblyReference>WindowsBase</AssemblyReference>
      <AssemblyReference>PresentationCore</AssemblyReference>
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>Microsoft.VisualBasic</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Drawing</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>PresentationFramework</AssemblyReference>
      <AssemblyReference>WindowsBase</AssemblyReference>
      <AssemblyReference>PresentationCore</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>UiPath.System.Activities</AssemblyReference>
      <AssemblyReference>UiPath.UiAutomation.Activities</AssemblyReference>
      <AssemblyReference>System.ServiceModel</AssemblyReference>
      <AssemblyReference>UiPath.Excel</AssemblyReference>
      <AssemblyReference>UiPath.Mail</AssemblyReference>
      <AssemblyReference>UiPath.System.Activities.Design</AssemblyReference>
      <AssemblyReference>System.ValueTuple</AssemblyReference>
      <AssemblyReference>System.ComponentModel.Composition</AssemblyReference>
      <AssemblyReference>System.Memory</AssemblyReference>
      <AssemblyReference>System.Data.DataSetExtensions</AssemblyReference>
      <AssemblyReference>UiPath.GSuite.Activities.Design</AssemblyReference>
      <AssemblyReference>Microsoft.Bcl.AsyncInterfaces</AssemblyReference>
      <AssemblyReference>UiPath.CV</AssemblyReference>
      <AssemblyReference>System.Interactive.Async</AssemblyReference>
      <AssemblyReference>UiPathTeam.WorkModule.Activities</AssemblyReference>
      <AssemblyReference>Newtonsoft.Json</AssemblyReference>
      <AssemblyReference>System.Linq.Async</AssemblyReference>
      <AssemblyReference>System.Runtime.Serialization</AssemblyReference>
      <AssemblyReference>Microsoft.Extensions.DependencyModel</AssemblyReference>
      <AssemblyReference>UiPath.Database.Activities.Design</AssemblyReference>
      <AssemblyReference>UiPath.Mail.Activities.Design</AssemblyReference>
      <AssemblyReference>UiPath.Web.Activities.Design</AssemblyReference>
      <AssemblyReference>UiPath.Web.Activities</AssemblyReference>
    </scg:List>
  </TextExpression.ReferencesForImplementation>

For anyone encountering the same problem, the only solution that worked for me was to delete the files in the .local folder and the .settings folder of the project. This was the only method that successfully removed the error message. While I’m not certain if this is the most reasonable approach, it didn’t corrupt the files, so I assume it’s acceptable. Nonetheless, it’s best to back up the files before proceeding as explained above.

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