SlideShare a Scribd company logo
1 of 18
Download to read offline
Leveraging UiPath .NET integration to build JSON in
a simple, readable and repeatable way
By Jack Dale
Monday, 24th October, 2022
www.vkyautomation.com
Contents
A Little Context
A Brief Tour of JSON
Building JSON Using UiPath Activities
Problems with the Activity Approach
Leveraging .NET integration
A Word of Warning
Going Further
Concluding Remarks
> Our automations must interact with a range of
applications and systems.
> UiPath has a sophisticated UI detection system,
but this may not be consistently reliable.
> Automations are at the mercy of the applications
they interact with.
> Alternatively, our automations can interact with
APIs.
> Major architectural styles: SOAP (typically uses XML)
and REST (typically uses JSON).
> REST requests can be complex and difficult to
construct in UiPath, but not anymore!
A little context
> Syntax borrowed from JavaScript.
> Composed of 6 core structures
> Objects -> ‘{ }’
> Arrays -> ‘[ ]’
> Strings
> Numbers
> true and false
> null
> Objects are made up of key-value pairs (called
“properties” in JS speak).
> Arrays can contain any of the structures, but not
key-value pairs.
> Arrays are non-homogenous: an array can hold
objects and strings and numbers etc.
JSON (briefly)
{
"createdAt": "2019-03-29T12:24:08.129Z",
"firstName": "Dereck",
"managerID": 86918,
"lastName": "Upton",
"title": "Mr.",
"jobTitle": "Legacy Mobility Agent",
"city": "New Imogeneberg",
"workingPattern": 29262,
"workEmail": "dereckUpton22@gmail.com",
"workMobile": "262-672-5659",
}
Demo
> To construct the previous example using UiPath
would require:
> An assign activity to create the top-level JSON object.
> 10 Invoke Method activities to add each property to
the top-level JSON object.
> Perhaps an assign activity to format the date-time
for ‘createdAt’.
> What about activities to format phone numbers and
emails?
> Things can get worse…
Constructing JSON using UiPath activities
{
"executionID": "09effed7-6520-46d7-8abe-b1e1d15657b8",
"supportedCPUTargets":[
"ARM",
"Intel",
"AMD"
],
"runningTime": 5700,
"recommendedExecEnv": [
{
"cpuType": "ARM",
"coreCount": 4,
"ram": 16,
"virtualization": false
},
{
"cpuType": "Intel",
"coreCount": 4,
"ram": 8,
"virtualization": true
},
{
"cpuType": "AMD",
"coreCount": 6,
"ram": 32,
"virtualization": null
},
"Windows",
"Mac",
"Debian"
]
}
Demo
> Workflow pollution:
> Lots of almost exact duplicates of a single activity,
just with different parameters.
> Reduced readability:
> Non-standard differentiation - how should we tell the
difference between each activity? With comments?
Annotations? Renamed activities?
> Likely to make a mistake if adding more
properties later in development:
> One of the already existing activities must be copied,
pasted, relabelled, and its arguments changed to the
required values.
Problems with the activity approach
> As UiPath is built on .NET, we can use its
integration to our advantage.
> Use the ‘dynamic’ C# keyword.
> Bypasses compile-time type checking.
> Checks are done at run-time instead.
> Let's us add properties to a JObject in a manner
more akin to actual JavaScript.
> There are exceptions to the rule.
> No more untidiness!
> A single Invoke Code activity compared to many
Assign’s and Invoke Method’s.
Have no fear, Invoke Code is here!
Demo
> VB.NET does not have a ‘dynamic’ keyword equivalent.
> Instead use ‘Option Strict Off’.
> UiPath has ‘Option Strict On’ by default - there is no way to turn it off.
> We can still reap the benefits of Invoke Code, we just can’t build JSON JS-style.
A sidenote about VB.NET
> Certain property names can only be added using
the ‘Add’ method.
> This is easy to do though, simply type:
<jObj>.Add(<property name>, <value>);
> Where:
> <jObj> = the name of your JObject
> <property name> = your property name*
> <value> = the value being added
* Property names that are not alpha-numeric or
‘_’ must be added with the Add method.
* Google provide a best-practice style guide, found
here
A word of warning
> We’ve discussed building JSON to send REST
requests, but what about receiving responses?
> Believe it or not, the very same principles apply:
> JSON responses can be complex and deeply nested.
> We could extract the data we need using UiPath
activities, but…
> Unless the JSON structure is very simple, we will fall
into the same trap as when sending requests.
> As before, we can simplify our workflows using
invoke Code, but there’s a twist.
> To help us extract the data we need, we can use a
language feature called LINQ, but that is a story for
another time…
Going further
> Using an API is always preferable to interacting with GUIs.
> Constructing JSON doesn’t need to be arduous and
complicated.
> Adding JSON properties using standard activities is
cumbersome and makes workflows unreadable.
> We can replace our activities with a single Invoke Code.
> Using ‘dynamic’ to bypass static type checking combined
with the JObject .NET class, we can compact JSON
construction to a single activity.
> Property names which contain non-alpha-numeric
characters (except ‘_’) must be added using Add.
Concluding remarks

More Related Content

Similar to Leveraging UiPath .NET integration to build JSON

Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Red Hat Developers
 
How to develop an API with PHP, JSON, and POSTMAN in 9 Steps.pdf
How to develop an API with PHP, JSON, and POSTMAN in 9 Steps.pdfHow to develop an API with PHP, JSON, and POSTMAN in 9 Steps.pdf
How to develop an API with PHP, JSON, and POSTMAN in 9 Steps.pdfBe Problem Solver
 
Rails and iOS with RestKit
Rails and iOS with RestKitRails and iOS with RestKit
Rails and iOS with RestKitAndrew Culver
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)Igor Bronovskyy
 
Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Christian Heilmann
 
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...Knoldus Inc.
 
Play framework training by Neelkanth Sachdeva @ Scala Traits Event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala Traits Event , New Delh...Play framework training by Neelkanth Sachdeva @ Scala Traits Event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala Traits Event , New Delh...Neelkanth Sachdeva
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin Vasil Remeniuk
 
Fighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with EmbulkFighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with EmbulkSadayuki Furuhashi
 
PLNOG 18 - Piotr Wojciechowski - REST API czyli jak miękko wejść w programowa...
PLNOG 18 - Piotr Wojciechowski - REST API czyli jak miękko wejść w programowa...PLNOG 18 - Piotr Wojciechowski - REST API czyli jak miękko wejść w programowa...
PLNOG 18 - Piotr Wojciechowski - REST API czyli jak miękko wejść w programowa...PROIDEA
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop OverviewShubhra Kar
 
Ice mini guide
Ice mini guideIce mini guide
Ice mini guideAdy Liu
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Ran Mizrahi
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Ran Mizrahi
 
Google cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstractionGoogle cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstractionBruce McPherson
 
Expanding your impact with programmability in the data center
Expanding your impact with programmability in the data centerExpanding your impact with programmability in the data center
Expanding your impact with programmability in the data centerCisco Canada
 
Why Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiWhy Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiJackson Tian
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.jsguileen
 

Similar to Leveraging UiPath .NET integration to build JSON (20)

Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
Full Stack Development With Node.Js And NoSQL (Nic Raboy & Arun Gupta)
 
Switch to Backend 2023
Switch to Backend 2023Switch to Backend 2023
Switch to Backend 2023
 
How to develop an API with PHP, JSON, and POSTMAN in 9 Steps.pdf
How to develop an API with PHP, JSON, and POSTMAN in 9 Steps.pdfHow to develop an API with PHP, JSON, and POSTMAN in 9 Steps.pdf
How to develop an API with PHP, JSON, and POSTMAN in 9 Steps.pdf
 
Rails and iOS with RestKit
Rails and iOS with RestKitRails and iOS with RestKit
Rails and iOS with RestKit
 
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
09 - express nodes on the right angle - vitaliy basyuk - it event 2013 (5)
 
Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010
 
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala traits event , New Delh...
 
Play framework training by Neelkanth Sachdeva @ Scala Traits Event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala Traits Event , New Delh...Play framework training by Neelkanth Sachdeva @ Scala Traits Event , New Delh...
Play framework training by Neelkanth Sachdeva @ Scala Traits Event , New Delh...
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin
 
Fighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with EmbulkFighting Against Chaotically Separated Values with Embulk
Fighting Against Chaotically Separated Values with Embulk
 
PLNOG 18 - Piotr Wojciechowski - REST API czyli jak miękko wejść w programowa...
PLNOG 18 - Piotr Wojciechowski - REST API czyli jak miękko wejść w programowa...PLNOG 18 - Piotr Wojciechowski - REST API czyli jak miękko wejść w programowa...
PLNOG 18 - Piotr Wojciechowski - REST API czyli jak miękko wejść w programowa...
 
StrongLoop Overview
StrongLoop OverviewStrongLoop Overview
StrongLoop Overview
 
Ice mini guide
Ice mini guideIce mini guide
Ice mini guide
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
 
Google cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstractionGoogle cloud datastore driver for Google Apps Script DB abstraction
Google cloud datastore driver for Google Apps Script DB abstraction
 
Expanding your impact with programmability in the data center
Expanding your impact with programmability in the data centerExpanding your impact with programmability in the data center
Expanding your impact with programmability in the data center
 
Why Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiWhy Nodejs Guilin Shanghai
Why Nodejs Guilin Shanghai
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.js
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 

More from Cristina Vidu

Communauté UiPath Suisse romande - Séance de janvier 2024
Communauté UiPath Suisse romande - Séance de janvier 2024Communauté UiPath Suisse romande - Séance de janvier 2024
Communauté UiPath Suisse romande - Séance de janvier 2024Cristina Vidu
 
State of the Automation Professional 2023: Insights and Implications for Nigeria
State of the Automation Professional 2023: Insights and Implications for NigeriaState of the Automation Professional 2023: Insights and Implications for Nigeria
State of the Automation Professional 2023: Insights and Implications for NigeriaCristina Vidu
 
Steps towards RPA Development: Create a Process Assessment Matrix
Steps towards RPA Development: Create a Process Assessment Matrix Steps towards RPA Development: Create a Process Assessment Matrix
Steps towards RPA Development: Create a Process Assessment Matrix Cristina Vidu
 
Dev Dives: Design user-friendly attended automations from A to Z
Dev Dives: Design user-friendly attended automations from A to ZDev Dives: Design user-friendly attended automations from A to Z
Dev Dives: Design user-friendly attended automations from A to ZCristina Vidu
 
Dev Dives: Unlock AI-driven automation with semantic automation & communicati...
Dev Dives: Unlock AI-driven automation with semantic automation & communicati...Dev Dives: Unlock AI-driven automation with semantic automation & communicati...
Dev Dives: Unlock AI-driven automation with semantic automation & communicati...Cristina Vidu
 
Advocating for the customer. Bringing soft skills into software development
Advocating for the customer. Bringing soft skills into software developmentAdvocating for the customer. Bringing soft skills into software development
Advocating for the customer. Bringing soft skills into software developmentCristina Vidu
 
🌺 Women in Automation Program: Become an RPA Developer with UiPath Studio Ses...
🌺 Women in Automation Program: Become an RPA Developer with UiPath Studio Ses...🌺 Women in Automation Program: Become an RPA Developer with UiPath Studio Ses...
🌺 Women in Automation Program: Become an RPA Developer with UiPath Studio Ses...Cristina Vidu
 
Steps towards RPA Development: How to Document your Automation.pdf
Steps towards RPA Development: How to Document your Automation.pdfSteps towards RPA Development: How to Document your Automation.pdf
Steps towards RPA Development: How to Document your Automation.pdfCristina Vidu
 
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...Cristina Vidu
 
Women in Automation - Intro to Studio Session 1
Women in Automation - Intro to Studio Session 1Women in Automation - Intro to Studio Session 1
Women in Automation - Intro to Studio Session 1Cristina Vidu
 
Think before we automate
Think before we automateThink before we automate
Think before we automateCristina Vidu
 
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...Cristina Vidu
 
Women in Automation - Introduction to RPA
Women in Automation - Introduction to RPAWomen in Automation - Introduction to RPA
Women in Automation - Introduction to RPACristina Vidu
 
Conversational AI and Chatbot Integrations
Conversational AI and Chatbot IntegrationsConversational AI and Chatbot Integrations
Conversational AI and Chatbot IntegrationsCristina Vidu
 
Let’s build an app with UiPath Apps!
Let’s build an app with UiPath Apps!Let’s build an app with UiPath Apps!
Let’s build an app with UiPath Apps!Cristina Vidu
 
Dev Dives: Unlock automation adoption with UiPath Apps
Dev Dives: Unlock automation adoption with UiPath AppsDev Dives: Unlock automation adoption with UiPath Apps
Dev Dives: Unlock automation adoption with UiPath AppsCristina Vidu
 
UiPath Amsterdam DEV meet-up For Developers, By Developers
UiPath Amsterdam DEV meet-up For Developers, By DevelopersUiPath Amsterdam DEV meet-up For Developers, By Developers
UiPath Amsterdam DEV meet-up For Developers, By DevelopersCristina Vidu
 
Jahresplanung und Content Map
Jahresplanung und Content MapJahresplanung und Content Map
Jahresplanung und Content MapCristina Vidu
 
Webinar - Utilizzo delle WebApi dell'Orchestrator.pdf
Webinar - Utilizzo delle WebApi dell'Orchestrator.pdfWebinar - Utilizzo delle WebApi dell'Orchestrator.pdf
Webinar - Utilizzo delle WebApi dell'Orchestrator.pdfCristina Vidu
 

More from Cristina Vidu (20)

Communauté UiPath Suisse romande - Séance de janvier 2024
Communauté UiPath Suisse romande - Séance de janvier 2024Communauté UiPath Suisse romande - Séance de janvier 2024
Communauté UiPath Suisse romande - Séance de janvier 2024
 
State of the Automation Professional 2023: Insights and Implications for Nigeria
State of the Automation Professional 2023: Insights and Implications for NigeriaState of the Automation Professional 2023: Insights and Implications for Nigeria
State of the Automation Professional 2023: Insights and Implications for Nigeria
 
Steps towards RPA Development: Create a Process Assessment Matrix
Steps towards RPA Development: Create a Process Assessment Matrix Steps towards RPA Development: Create a Process Assessment Matrix
Steps towards RPA Development: Create a Process Assessment Matrix
 
Dev Dives: Design user-friendly attended automations from A to Z
Dev Dives: Design user-friendly attended automations from A to ZDev Dives: Design user-friendly attended automations from A to Z
Dev Dives: Design user-friendly attended automations from A to Z
 
Dev Dives: Unlock AI-driven automation with semantic automation & communicati...
Dev Dives: Unlock AI-driven automation with semantic automation & communicati...Dev Dives: Unlock AI-driven automation with semantic automation & communicati...
Dev Dives: Unlock AI-driven automation with semantic automation & communicati...
 
Advocating for the customer. Bringing soft skills into software development
Advocating for the customer. Bringing soft skills into software developmentAdvocating for the customer. Bringing soft skills into software development
Advocating for the customer. Bringing soft skills into software development
 
🌺 Women in Automation Program: Become an RPA Developer with UiPath Studio Ses...
🌺 Women in Automation Program: Become an RPA Developer with UiPath Studio Ses...🌺 Women in Automation Program: Become an RPA Developer with UiPath Studio Ses...
🌺 Women in Automation Program: Become an RPA Developer with UiPath Studio Ses...
 
Steps towards RPA Development: How to Document your Automation.pdf
Steps towards RPA Development: How to Document your Automation.pdfSteps towards RPA Development: How to Document your Automation.pdf
Steps towards RPA Development: How to Document your Automation.pdf
 
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...
 
Women in Automation - Intro to Studio Session 1
Women in Automation - Intro to Studio Session 1Women in Automation - Intro to Studio Session 1
Women in Automation - Intro to Studio Session 1
 
Think before we automate
Think before we automateThink before we automate
Think before we automate
 
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...
🌺 Women in Automation Program: Become a Citizen Developer with UiPath StudioX...
 
Women in Automation - Introduction to RPA
Women in Automation - Introduction to RPAWomen in Automation - Introduction to RPA
Women in Automation - Introduction to RPA
 
Conversational AI and Chatbot Integrations
Conversational AI and Chatbot IntegrationsConversational AI and Chatbot Integrations
Conversational AI and Chatbot Integrations
 
RPA Karaoke
RPA Karaoke RPA Karaoke
RPA Karaoke
 
Let’s build an app with UiPath Apps!
Let’s build an app with UiPath Apps!Let’s build an app with UiPath Apps!
Let’s build an app with UiPath Apps!
 
Dev Dives: Unlock automation adoption with UiPath Apps
Dev Dives: Unlock automation adoption with UiPath AppsDev Dives: Unlock automation adoption with UiPath Apps
Dev Dives: Unlock automation adoption with UiPath Apps
 
UiPath Amsterdam DEV meet-up For Developers, By Developers
UiPath Amsterdam DEV meet-up For Developers, By DevelopersUiPath Amsterdam DEV meet-up For Developers, By Developers
UiPath Amsterdam DEV meet-up For Developers, By Developers
 
Jahresplanung und Content Map
Jahresplanung und Content MapJahresplanung und Content Map
Jahresplanung und Content Map
 
Webinar - Utilizzo delle WebApi dell'Orchestrator.pdf
Webinar - Utilizzo delle WebApi dell'Orchestrator.pdfWebinar - Utilizzo delle WebApi dell'Orchestrator.pdf
Webinar - Utilizzo delle WebApi dell'Orchestrator.pdf
 

Recently uploaded

Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxFIDO Alliance
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewDianaGray10
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...panagenda
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Paige Cruz
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Revolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial IntelligenceRevolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial IntelligencePrecisely
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxjbellis
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxFIDO Alliance
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxFIDO Alliance
 

Recently uploaded (20)

Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Revolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial IntelligenceRevolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial Intelligence
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 

Leveraging UiPath .NET integration to build JSON

  • 1. Leveraging UiPath .NET integration to build JSON in a simple, readable and repeatable way By Jack Dale Monday, 24th October, 2022 www.vkyautomation.com
  • 2. Contents A Little Context A Brief Tour of JSON Building JSON Using UiPath Activities Problems with the Activity Approach Leveraging .NET integration A Word of Warning Going Further Concluding Remarks
  • 3. > Our automations must interact with a range of applications and systems. > UiPath has a sophisticated UI detection system, but this may not be consistently reliable. > Automations are at the mercy of the applications they interact with. > Alternatively, our automations can interact with APIs. > Major architectural styles: SOAP (typically uses XML) and REST (typically uses JSON). > REST requests can be complex and difficult to construct in UiPath, but not anymore! A little context
  • 4. > Syntax borrowed from JavaScript. > Composed of 6 core structures > Objects -> ‘{ }’ > Arrays -> ‘[ ]’ > Strings > Numbers > true and false > null > Objects are made up of key-value pairs (called “properties” in JS speak). > Arrays can contain any of the structures, but not key-value pairs. > Arrays are non-homogenous: an array can hold objects and strings and numbers etc. JSON (briefly)
  • 5. { "createdAt": "2019-03-29T12:24:08.129Z", "firstName": "Dereck", "managerID": 86918, "lastName": "Upton", "title": "Mr.", "jobTitle": "Legacy Mobility Agent", "city": "New Imogeneberg", "workingPattern": 29262, "workEmail": "dereckUpton22@gmail.com", "workMobile": "262-672-5659", }
  • 6.
  • 8. > To construct the previous example using UiPath would require: > An assign activity to create the top-level JSON object. > 10 Invoke Method activities to add each property to the top-level JSON object. > Perhaps an assign activity to format the date-time for ‘createdAt’. > What about activities to format phone numbers and emails? > Things can get worse… Constructing JSON using UiPath activities
  • 9. { "executionID": "09effed7-6520-46d7-8abe-b1e1d15657b8", "supportedCPUTargets":[ "ARM", "Intel", "AMD" ], "runningTime": 5700, "recommendedExecEnv": [ { "cpuType": "ARM", "coreCount": 4, "ram": 16, "virtualization": false }, { "cpuType": "Intel", "coreCount": 4, "ram": 8, "virtualization": true }, { "cpuType": "AMD", "coreCount": 6, "ram": 32, "virtualization": null }, "Windows", "Mac", "Debian" ] }
  • 10. Demo
  • 11. > Workflow pollution: > Lots of almost exact duplicates of a single activity, just with different parameters. > Reduced readability: > Non-standard differentiation - how should we tell the difference between each activity? With comments? Annotations? Renamed activities? > Likely to make a mistake if adding more properties later in development: > One of the already existing activities must be copied, pasted, relabelled, and its arguments changed to the required values. Problems with the activity approach
  • 12. > As UiPath is built on .NET, we can use its integration to our advantage. > Use the ‘dynamic’ C# keyword. > Bypasses compile-time type checking. > Checks are done at run-time instead. > Let's us add properties to a JObject in a manner more akin to actual JavaScript. > There are exceptions to the rule. > No more untidiness! > A single Invoke Code activity compared to many Assign’s and Invoke Method’s. Have no fear, Invoke Code is here!
  • 13. Demo
  • 14.
  • 15. > VB.NET does not have a ‘dynamic’ keyword equivalent. > Instead use ‘Option Strict Off’. > UiPath has ‘Option Strict On’ by default - there is no way to turn it off. > We can still reap the benefits of Invoke Code, we just can’t build JSON JS-style. A sidenote about VB.NET
  • 16. > Certain property names can only be added using the ‘Add’ method. > This is easy to do though, simply type: <jObj>.Add(<property name>, <value>); > Where: > <jObj> = the name of your JObject > <property name> = your property name* > <value> = the value being added * Property names that are not alpha-numeric or ‘_’ must be added with the Add method. * Google provide a best-practice style guide, found here A word of warning
  • 17. > We’ve discussed building JSON to send REST requests, but what about receiving responses? > Believe it or not, the very same principles apply: > JSON responses can be complex and deeply nested. > We could extract the data we need using UiPath activities, but… > Unless the JSON structure is very simple, we will fall into the same trap as when sending requests. > As before, we can simplify our workflows using invoke Code, but there’s a twist. > To help us extract the data we need, we can use a language feature called LINQ, but that is a story for another time… Going further
  • 18. > Using an API is always preferable to interacting with GUIs. > Constructing JSON doesn’t need to be arduous and complicated. > Adding JSON properties using standard activities is cumbersome and makes workflows unreadable. > We can replace our activities with a single Invoke Code. > Using ‘dynamic’ to bypass static type checking combined with the JObject .NET class, we can compact JSON construction to a single activity. > Property names which contain non-alpha-numeric characters (except ‘_’) must be added using Add. Concluding remarks