Invoke Code doesn't work throught Invoke OpenRPA

Hi. I’m using a code to serialize a JSON into a DataTable. If i use the code on the main workflow, it works fine. If i use the same code in another workflow that is called by Invoke OpenRPA, the code doesn’t work and i get the error: “The name 'JArray” does not exist in the current context"

Is this a bug?

var jsonArray = JArray.Parse(httpResponse);
var dataTable = new DataTable();

foreach (var property in jsonArray[0].Children())
{
dataTable.Columns.Add(property.Name, typeof(string));
}

foreach (var jsonObject in jsonArray)
{
var row = dataTable.NewRow();
foreach (var property in jsonObject.Children())
{
row[property.Name] = property.Value.ToString();
}
dataTable.Rows.Add(row);
}

//dataTable.AsEnumerable().ToList().ForEach(r => Console.WriteLine(string.Join(", ", r.ItemArray)));
chamados = dataTable;

You need to add newtonsoft as a namespace
Look under imports in the working workflow and compare with the one not working, and fåsdd the mising inports ( the last tab where you also have variables and arguments )

It was Newtonsoft.Json.Linq.

Thank you very much.

1 Like

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