I have this json, and I want to extract for each entity the entity id, the value, and the confidence. I am using a for each (item in json) and item.name for the entity id which is working fine. However, much trial and error has not helped me extract the value or confidence.
Normally I’d name the fields I want from the deserialised json, eg json.root(“sentiment”).item(“value”).value(of string). However, this does not apply in the for each scenario, when the number and types of entity could change. Furthermore, this only goes two levels down, and I require 3 levels for this.
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
Newtonsoft.Json.JsonReaderException: Error reading JArray from JsonReader. Current JsonReader item is not an array: String. Path ‘’, line 1, position 11.
at Newtonsoft.Json.Linq.JArray.Load(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JArray.Parse(String json, JsonLoadSettings settings)
at UiPath.Web.Activities.DeserializeJsonArray.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
if i deserialise jsonObject(“entities”).tostring into a new JObject, and use my usual .root(name).item(name).value(of string) then I get an error Assign: Accessed JArray values with invalid key value: “value”. Int32 array index expected.