When I use For Each in UiPath, it shows "Option Strict On disallows late binding"

295 Views Asked by At

error image

First, I call an API endpoint to get the response, and I convert the response to jsonResult by using Deserialize JSON.

jsonResult is an object, with fields such as "code", "status", "data". jsonResult("data") is a user List.

Now I need to use these users' name one by one. So I use For Each on the List: jsonResult("data"), the item in the List is named currentItem, then the username would be currentItem("name"), right? But it shows error: Option Strict On disallows late binding.

But before the "For Each", if I print jsonResult("data")(0)("name"), there's no error at all. And if I use "For Each" and then I print the currentItem directly instead of currentItem("name"), there's no error either. How can I solve this issue? I need to use these users' name one by one for some activities.

1

There are 1 best solutions below

0
kwoxer On

Pretty easy. You need to set the proper type.

  1. Click For Each
  2. Select TypeArgument
  3. Make sure JObject is selected