Handling JSON Object array argument

I am receiving a JSON object array from argument. How can i deserialize it and assign the values to variables I made?

I am using openRPA 1.4.57

Thank you in advance

A JObject[] into variables will get a bit tricky, as you’d need a structure to deserialize it to. The standard way in VB would be something like this:
YourClassType[] someThings = JsonConvert.DeserializeObject(Of YourClassType[])(yourResponseContent)

But, if you don’t have a class that corresponds with the structure, you will need to most likely do something like this

foreach (JObject oneObject in myResponses)
{
   int myInt = CInt(JObject("someFieldName))
   string myText = JObject("someOtherField").ToString()
   ...
}

and so on.

From activities perspective, it would be a ForEach<> activity, with the type set to JObject, and then a bunch of assigns.

2 Likes

Thank you for your response AndrewK. I will definitely try this.

I have decided to use nodered that will pass the object to workflow using RPA node so the JSON object is not an issue anymore. Thanks anyway :slight_smile:

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