How to Fix “Unexpected character encountered while parsing value: T.” in UiPath Deserialize JSON Activity?

Why does the Deserialize JSON activity in UiPath throw the error "Unexpected character encountered while parsing value: T." when processing a JSON string with boolean values?

Issue Description

The Deserialize JSON activity fails at runtime and the workflow stops with an exception. This happens when the JSON string passed to the activity contains one or more boolean values written with a capital letter (True or False). Instead of producing a JObject, the activity halts at that step and raises a Newtonsoft.Json.JsonReaderException.

Affected Packages

  • UiPath.System.Activities
  • UiPath.WebAPI.Activities

Activities

When working with UiPath Studio and using the Deserialize JSON activity (from UiPath.WebAPI.Activities), you may encounter the following runtime error:

25.10.12+Branch.support-v25.10.Sha.d76f5f8929ca42b9659983b74d9cf92d21a11fa0.d76f5f8929ca42b9659983b74d9cf92d21a11fa0

Source: Deserialize JSON

Message: Unexpected character encountered while parsing value: T. Path 'isActive', line 1, position 137.

Exception Type: Newtonsoft.Json.JsonReaderException

in Sequence.xaml
at DeserializeJson`1 "Deserialize JSON"
at Sequence "Sequence"
at Sequence "Sequence"

Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: T. Path 'isActive', line 1, position 137.
at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonWriter.WriteToken(JsonReader reader, Boolean writeChildren, Boolean writeDateConstructorAsDate, Boolean writeComments)
at Newtonsoft.Json.JsonWriter.WriteToken(JsonReader reader, Boolean writeChildren)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateJToken(JsonReader reader, JsonContract contract)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at UiPath.Web.Activities.DeserializeJson`1.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

This error typically occurs when parsing a JSON string that contains boolean values written as True or False (capitalized), which is invalid according to JSON standards.

Example Scenario

Assign Activity (System.String)

You may have an Assign activity storing the following value:

jsonString = "{""accountNumber"": ""ACC-789456123"",""accountHolder"": ""Jane Doe"",""accountType"": ""Savings"",""balance"": 15420.75,""currency"": ""USD"",""isActive"": True}"

Then, you pass the Json string into a Deserialize JSON activity and use the output.

Cause

This error occurs when the JSON string contains boolean values written as True or False (capitalized), which is invalid according to JSON standards.

JSON strictly requires:

  • true (lowercase)
  • false (lowercase)

But not:

  • True
  • False

So the parser fails when encountering:

"isActive": True


Resolution

Option 1: Fix JSON Format (Recommended)

Modify the Assign activity to use valid JSON.

Correct the capitalization errors in the JSON string, from "True" to "true" (for example).

Option 2: Pre-process the JSON String

If the JSON comes from an external source and cannot be changed:

jsonString = jsonString.Replace(": True", ": true").Replace(": False", ": false")

De-serialize it:

jsonObj = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Newtonsoft.Json.Linq.JObject)(jsonString)

In case there is a need to extract the isActive value from the JSON, the following example as a reference can be used without the Deserialize JSON activity:

Newtonsoft.Json.JsonConvert.DeserializeObject(Of Newtonsoft.Json.Linq.JObject)(jsonString)("isActive")


Option 3: Custom Handling (Advanced)

While Newtonsoft.Json does not natively support case-insensitive booleans; these could be performed:

  • Implement a custom converter
  • Or sanitize the string before parsing (preferred approach)

Key Takeaway

Always ensure your JSON follows strict standards:

  • Strings must be in double quotes
  • Boolean values must be lowercase (true / false)