Study guide

6.3 JSON Parsing, JSONPath & Serialization with Newtonsoft.Json

UiPath Automation Developer Professional UiPath-ADPv1

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Exam Overview & Blueprint Map

1.1 About the UiPath-ADPv1 Exam: Format, Fees & Policies 1.2 The Exam Topics Mapped to This Guide & a Study Plan

2 Chapter 2: REFramework Architecture & State Dynamics

2.1 State Machine Architecture & The Four Core States 2.2 Configuration Management: Settings, Constants, and Assets 2.3 Transaction Types & The Dispatcher vs. Performer Architecture 2.4 Adapting REFramework: Tabular Data, Collections & Linear Processes

3 Chapter 3: REFramework Exception Handling & Recovery

3.1 BusinessRuleException vs. System.Exception Handling Patterns 3.2 Retry Mechanisms: Queue Retries vs. REFramework MaxRetryNumber 3.3 Consecutive System Exceptions & Graceful Process Termination

4 Chapter 4: State Machines, Custom Log Fields & REFramework Testing

4.1 Building State Machine Projects in Studio 4.2 Logging Levels, Robot Logs & Custom Log Fields in REFramework 4.3 Testing a REFramework Project With and Without Orchestrator Queues

5 Chapter 5: LINQ Queries & DataTable Operations

5.1 LINQ Essentials for Collections & Filtering 5.2 Advanced DataTable Querying with LINQ 5.3 In-Memory DataTable Transformations & Column Operations

6 Chapter 6: Regex, DateTime, JSON & Invoke Activities

6.1 Regular Expressions & Text Parsing for Automation 6.2 DateTime Formatting, Timezone Conversions & TimeSpan Calculations 6.3 JSON Parsing, JSONPath & Serialization with Newtonsoft.Json 6.4 Invoke Method & Invoke Code Activities 6.5 Data Referencing in Invokes: DataTable, List & Dictionary Arguments

7 Chapter 7: Modern UI Automation & Unified Targeting

7.1 Modern Design Experience & The Unified Target Concept 7.2 Anchors, Relative Elements & UI Automation Activities 7.3 Dynamic Selectors, Variables & Wildcards in Selectors

8 Chapter 8: Object Repository, Computer Vision & Remote Runtime

8.1 Object Repository & UI Descriptor Libraries 8.2 AI Computer Vision for Unattended & Remote Interfaces 8.3 Automation in Virtual Environments & UiPath Remote Runtime

9 Chapter 9: Advanced UI Automation: Browser Modes, Agentic UI & macOS

9.1 Browser Automation with the WebDriver Protocol 9.2 Agentic UI Automation: ScreenPlay, Semantic Activities & Healing Agent 9.3 macOS Automation: Native Apps, Office Apps & AppleScript

10 Chapter 10: Advanced Control Flow & Exception Architecture

10.1 Flowcharts, Sequences & Parallel Control Flow Patterns 10.2 Global Exception Handler Architecture & ErrorAction Directives 10.3 TryCatch, Retry Scope & Custom Exception Architectures

11 Chapter 11: Orchestrator Queues & Transaction Management

11.1 Queue Architecture, SpecificContent & Transaction Lifecycles 11.2 Queue Items SLA, Postpone, Deadlines & Priority Scheduling 11.3 Bulk Operations, Transaction Status Updates & Queue Triggers

12 Chapter 12: Orchestrator Tenant & Folder Entities

12.1 Asset Types, Per-Robot Assets & External Credential Stores 12.2 Modern Folder Hierarchy, User/Robot Assignment & Permissions 12.3 Storage Buckets, Webhooks & Environment Promotion 12.4 Orchestrator Tags: Labels, Properties & Governance

13 Chapter 13: Unattended Execution, API Triggers & Cloud Robots

13.1 Unattended Job Execution: Folders, Priorities, Background vs. Foreground & Runtimes 13.2 API Triggers: Starting Jobs from External Systems over HTTP 13.3 Serverless and Cloud VM Robots: Cloud-Hosted Execution Options

14 Chapter 14: Monitoring, Recording & Solutions Management

14.1 Orchestrator Monitoring, Trigger Alerts & Job Health 14.2 Job and Transaction Recording: Troubleshooting Faulted Unattended Jobs 14.3 Solutions Management: Packaging and Deploying Automations with Their Resources

15 Chapter 15: Debugging, Remote Debugging & Profiling

15.1 Studio Debugging Tools: Breakpoints, Panels & Execution Control 15.2 Remote Debugging: Remote Machine and Unattended Robot Connections 15.3 Profile Execution: Finding Performance Bottlenecks in Studio

16 Chapter 16: RPA Testing & Test Suite

16.1 UiPath Test Suite Overview, Test Cases & Given-When-Then Structure 16.2 Data-Driven Testing, Test Verification Activities & Mock Activities 16.3 CI/CD Pipelines with uipcli & Test Manager Traceability

17 Chapter 17: Long-Running Workflows, Action Center & Apps

17.1 Long-Running Workflows: Persistence, Suspend and Resume 17.2 Action Center & Human-in-the-Loop Orchestration 17.3 UiPath Apps: Action Apps, Automations & Integration Service

18 Chapter 18: Trigger-Based Attended Automation & Callouts

18.1 Trigger-Based Attended Automation: Forms, Triggers & Global Variables 18.2 Running Local Triggers & the Event Inspection Tool 18.3 Callouts & Forms for Attended Guidance

19 Chapter 19: UiPath Assistant & Robot Sessions

19.1 UiPath Assistant: Automations, Reminders, Widgets & Configuration 19.2 Robot Session (Picture in Picture): Child Session vs. Virtual Desktop

20 Chapter 20: Autopilot for Developers & Autopilot for Everyone

20.1 Autopilot for Developers: AI Assistance in Studio and Studio Web 20.2 Autopilot for Everyone: Chat, Automations & Clipboard AI

21 Chapter 21: API Automation & Integration Service

21.1 Integration Service: Connectors, Connections & Connector Activities 21.2 API Workflows in Studio Web 21.3 HTTP Requests: Web APIs, the Orchestrator API & Connector Requests 21.4 Connector Builder: Custom Integration Service Connectors 21.5 Integration Service Event Triggers: Connected and Disconnected 21.6 GenAI Activities: Generative AI Inside Workflows

22 Chapter 22: Data Service, Context Grounding & Coded Workflows

22.1 Data Fabric (Data Service) Entities: Modeling Business Data 22.2 Data Fabric Activities and the Platform Connector 22.3 Context Grounding: Retrieval-Augmented Generation with Company Data 22.4 Coded Automations: Structure, Arguments & Invoking Workflows 22.5 Coded Automation Services: Orchestrator, UI Automation, Microsoft 365 & Custom Services

23 Chapter 23: Integrated Scenario Practice

23.1 Integrated Scenario Practice: Designing an End-to-End Solution

6.3 JSON Parsing, JSONPath & Serialization with Newtonsoft.Json

Key Takeaways Explain This Topic AI

Deserialize JSON outputs a JObject by default and Deserialize JSON Array outputs a JArray; both come from the Newtonsoft.Json library used by UiPath.

Reading a missing key returns Nothing, and chaining another indexer onto it throws a NullReferenceException.

SelectToken and SelectTokens evaluate JSONPath expressions such as $.items[?(@.sku)] ; SelectToken returns Nothing instead of throwing when the path is missing.

JsonConvert.SerializeObject and DeserializeObject(Of T) convert between JSON and typed .NET objects when a stable schema exists.

Queue item SpecificContent is limited to 256,000 characters, so large JSON documents belong in storage buckets.

Last updated: September 2026

6.3 JSON Parsing, JSONPath & Serialization with Newtonsoft.Json

Modern enterprise architectures rely heavily on RESTful web services, microservices, cloud applications, and integrations where JavaScript Object Notation (JSON) is the universal payload format. In UiPath Studio, handling REST APIs, Orchestrator Webhook payloads, and complex integration service responses requires fluent manipulation of JSON objects and arrays. This section covers the Newtonsoft.Json (Json.NET) architecture in UiPath, dynamic and strongly typed deserialization, and deep querying via JSONPath. The next section covers the Invoke Method and Invoke Code activities.

1. Architectural Foundation: JSON & Newtonsoft.Json in UiPath

In UiPath Studio, JSON processing is powered by the Newtonsoft.Json library (Json.NET), made available visually through the official UiPath.WebAPI.Activities package.

The JSON Document Object Model (DOM) Hierarchy

Json.NET models JSON data into an in-memory Document Object Model rooted in the abstract JToken class:

JToken : The abstract base class representing any JSON element (token, object, array, primitive value).

JObject : Represents a JSON object—an unordered collection of key-value pairs delimited by curly braces {} . Maps to dictionaries.

JArray : Represents a JSON array—an ordered collection of JToken elements delimited by square brackets [] . Maps to lists or arrays.

JValue : Represents primitive scalar values: string , integer , float , boolean , date , or null .

JProperty : Represents a single named key-value pair ( "name": value ) inside a JObject . [Newtonsoft.Json LINQ Object Hierarchy]

  • JToken (Abstract Base)
  • / \ \
  • JContainer JValue JProperty
  • / \
  • JObject JArray
  • Studio Visual Activities

Deserialize JSON : Accepts a raw JSON string and outputs a Newtonsoft.Json.Linq.JObject . Used for single payloads, status responses, and dictionary-like structures.

Deserialize JSON Array : Accepts a raw JSON string array and outputs a Newtonsoft.Json.Linq.JArray . Used for list payloads, search results, and batch records.

2. Dynamic Traversal, Extraction, and Modification of JObject and JArray

Once deserialized, developers can navigate JSON structures dynamically using indexer notation in Assign activities or expressions.

Indexer Navigation

Accessing nested properties uses chained string keys for objects and integer indices for arrays: ' VB.NET: Accessing nested customer address details

  • ' JSON: { "orderId": "1001", "customer": { "name": "Acme", "address": { "city": "Dallas", "zip": "75001" } } }
  • Dim cityName As String = jsonCustomer("customer")("address")("city").ToString()

Dim zipCode As String = jsonCustomer("customer")("address")("zip").ToString() // C#: Accessing nested customer address details

  • string cityName = jsonCustomer["customer"]["address"]["city"].ToString();
  • string zipCode = jsonCustomer["customer"]["address"]["zip"].ToString();
  • Iterating Over a JArray

When a JSON payload contains a list of items, iterate over the JArray using a standard UiPath For Each activity with TypeArgument set to Newtonsoft.Json.Linq.JToken (or JObject ): ' VB.NET: Iterating through an array of invoice line items

' JSON: { "items": [ { "sku": "A101", "qty": 2, "price": 45.0 }, { "sku": "B202", "qty": 1, "price": 110.0 } ] }

Dim itemsArray As JArray = CType(jsonInvoice("items"), JArray)

  • For Each lineItem As JToken In itemsArray
  • Dim sku As String = lineItem("sku").ToString()
  • Dim qty As Int32 = Convert.ToInt32(lineItem("qty"))
  • Dim price As Double = Convert.ToDouble(lineItem("price"))
  • Dim subtotal As Double = qty * price
  • Console.WriteLine("Item: " & sku & " | Subtotal: $" & subtotal.ToString("F2"))
  • Next
  • Defensive Null Handling and Key Existence

Reading a key that does not exist returns Nothing ; chaining another indexer onto that result, or calling .ToString() on it, throws a System.NullReferenceException : ' VB.NET: Defensive key checking before access

  • If jsonInvoice("customer") IsNot Nothing AndAlso jsonInvoice("customer")("taxId") IsNot Nothing Then
  • Dim taxId As String = jsonInvoice("customer")("taxId").ToString()
  • Else
  • Dim taxId As String = "NOT_PROVIDED"
  • End If
  • ' Alternatively, verify key presence via JObject.ContainsKey()
  • If jsonInvoice.ContainsKey("discountCode") Then
  • Dim discount As String = jsonInvoice("discountCode").ToString()
  • End If
  • In-Memory JSON Modification

Developers can modify, add, and remove properties in-place before forwarding payloads to downstream APIs: ' VB.NET: Updating and adding properties in JObject

  • jsonPayload("status") = "PROCESSED"
  • jsonPayload("processedTimestamp") = DateTime.UtcNow.ToString("o")
  • ' Adding a new nested object
  • Dim auditObj As New JObject()
  • auditObj("robotId") = "BOT-04"
  • auditObj("executionMachine") = Environment.MachineName
  • jsonPayload("audit") = auditObj
  • ' Removing a sensitive property
  • jsonPayload.Remove("creditCardCVV")
  • 3. Declarative JSONPath Querying with .SelectToken() and .SelectTokens()

Chained indexer navigation ( json("a")("b")(0)("c") ) is brittle when JSON structures are deeply nested or when schemas contain optional hierarchy levels. JSONPath is the declarative query language for JSON (analogous to XPath for XML).

Newtonsoft.Json provides native JSONPath evaluation via .SelectToken() and .SelectTokens() .

JSONPath Syntax Fundamentals

Syntax Token Meaning Architectural Description

$ Root object Refers to the root JSON element of the query.

. Child operator Navigates to a direct child property (e.g., $.store.book ).

.. Recursive descent Searches for matching keys across all descendant levels regardless of depth.

* Wildcard Matches all element properties or all array items.

[n] Array index Selects the element at zero-based array index n .

[?(@.expr)] Filter expression Filters array elements based on a logical predicate.

Querying with .SelectToken()

.SelectToken(path) : Returns a single JToken matching the path. If no matching token is found, it returns Nothing ( null ) without throwing an exception , enabling safe null-conditional evaluation!

.SelectTokens(path) : Returns an IEnumerable(Of JToken) containing all matching elements across the structure. ' VB.NET: Deep extraction using JSONPath

Dim sampleJson As String = "{ 'store': { 'books': [ { 'title': 'RPA Pro', 'price': 49.99, 'category': 'Tech' }, { 'title': 'Automation Arch', 'price': 59.99, 'category': 'Tech' }, { 'title': 'History', 'price': 19.99, 'category': 'General' } ] } }"

Dim storeObj As JObject = JObject.Parse(sampleJson)

  • ' Extract the title of the first book directly
  • Dim firstTitle As String = storeObj.SelectToken("$.store.books[0].title").ToString()
  • ' Extract all tech books using a filter expression
  • Dim techBooks As IEnumerable(Of JToken) = storeObj.SelectTokens("$.store.books[?(@.category == 'Tech')]")
  • For Each book As JToken In techBooks
  • Console.WriteLine("Tech Book: " & book("title").ToString() & " | Price: $" & book("price").ToString())
  • Next
  • ' Safe extraction: non-existent path returns Nothing without throwing
  • Dim discountToken As JToken = storeObj.SelectToken("$.store.discounts.holiday")
  • If discountToken IsNot Nothing Then
  • ' Process discount
  • End If
  • 4. Object Serialization & Strongly Typed Deserialization ( JsonConvert )

While dynamic manipulation with JObject is flexible, enterprise workflows requiring strict data contracts, compile-time validation, and automated schema enforcement benefit from strongly typed serialization and deserialization via Newtonsoft.Json.JsonConvert .

Serializing In-Memory Objects to JSON

The JsonConvert.SerializeObject() method converts .NET data structures—including DataTable , Dictionary(Of String, Object) , arrays, and custom classes—into standardized JSON strings: ' VB.NET: Serializing a Dictionary to JSON

  • Dim requestData As New Dictionary(Of String, Object) From {
  • {"TransactionID", "TX-9901"},
  • {"Amount", 1250.75},
  • {"IsApproved", True},
  • {"ProcessedAt", DateTime.UtcNow}
  • }

Dim jsonPayload As String = JsonConvert.SerializeObject(requestData, Newtonsoft.Json.Formatting.Indented) ' VB.NET: Serializing an entire DataTable to JSON table format

  • Dim jsonTable As String = JsonConvert.SerializeObject(dt_TransactionResults, Newtonsoft.Json.Formatting.None)
  • Deserializing to Strongly Typed Classes (POCO / DTO)

Defining Plain Old CLR Objects (POCO) or Data Transfer Objects (DTO) provides compile-time property safety, IntelliSense in Studio, and automatic type conversion: ' Class definition: put it in a code source file in the project or in a referenced library

  • ' (Invoke Code bodies cannot declare classes)
  • Public Class InvoiceDto
  • Public Property InvoiceNumber As String
  • Public Property VendorCode As String
  • Public Property TotalAmount As Decimal
  • Public Property DueDate As DateTime
  • End Class ' VB.NET: Strongly typed deserialization
  • Dim invoiceData As InvoiceDto = JsonConvert.DeserializeObject(Of InvoiceDto)(rawJsonString)

' Direct strongly-typed property access with zero casting:

  • Dim invNum As String = invoiceData.InvoiceNumber
  • Dim total As Decimal = invoiceData.TotalAmount // C#: Strongly typed deserialization
  • InvoiceDto invoiceData = JsonConvert.DeserializeObject<InvoiceDto>(rawJsonString);
  • string invNum = invoiceData.InvoiceNumber;
  • decimal total = invoiceData.TotalAmount;
  • Architectural Comparison: Dynamic JObject vs. Strongly Typed DTO
  • Criterion Dynamic JObject ( UiPath.WebAPI ) Strongly Typed POCO/DTO ( JsonConvert )
  • Setup Overhead Zero setup; parse immediately from string Requires defining a class or data model

Schema Flexibility High; adapts dynamically to payload variations Rigid; schema mismatches may fail or ignore fields

Type Safety None; requires runtime casting ( .ToString() , Convert ) Full compile-time type safety and IntelliSense

Maintenance Burden Prone to runtime typos in string property names High maintainability; refactoring tools update properties

Best Used For Dynamic API responses, unknown schemas, small payloads Core enterprise domain models, REFramework transaction data

JSON in Everyday UiPath Work

JSON shows up in several places on the exam:

HTTP Request activities and Integration Service connectors return JSON bodies that you deserialize before reading fields.

Orchestrator HTTP Request returns Orchestrator API responses as JSON strings, for example a list of queue items under a value array.

Webhook payloads from Orchestrator are JSON documents with properties such as Type , EventId , and Timestamp .

Queue item SpecificContent is stored as JSON in Orchestrator. Its size is limited to 256,000 characters (512,000 bytes), so large documents belong in a storage bucket with only a link in the item.