I used as a reference the last example from here Create JSON in UiPath Studio using VB.NET | UiPath in 5 minutes | Ep:5 - YouTube
- You need to add to your project the UiPath.WebAPI.Activities[1.13.3]
- Add a dummy (empty) HTTP request activity in your project and create a dummy JObject type variable (then you can remove them. This will import the needed JSON namespaces to your project)
- Create a variable of type
List <JObject>
- Add an Append item to collection activity (this will be needed to add for each of your elements)
The first element
JObject.FromObject(
New With {
key.text = "Edison",
key.category = "FasName",
key.offset = 101,
key.length = 8,
key.confidentScrore = 0.71,
key.cars = New String(){"BMW", "AUDI"}
}
)
- Add a new Append item to collection activity
The second element
JObject.FromObject(
New With {
key.text = "CUSTOMER: TATA STEEL",
key.category = "Contractor",
key.offset = 186,
key.lenght = 27,
key.confidentScrore = 0.84,
key.cars = New String(){"BMW", "MERCEDES"}
}
)
- Add Write line to add the headers details
JObject.FromObject(
New With{
key.headers = JArray.FromObject(list)
}).ToString
Results (I added cars as a reference in case you need to add a list of strings to one of your parameters in the future):
I attached the project made in Windows with VB.Net in UiPath Studio 2022.10.4 CreateJSONFile.zip (139.7 KB)