Error While Adding Json Strings To a List

I was trying to populate a list with String which is in a Json format.

The screenshots are above. The JStr variable type is String and ListofJsonString is List of Strings.

Here I tried to Add/Append JStr to the list but it is giving error like this

What could be the reason for this and how to resolve this issue.

Use the below method to solve your issue.

Just use invoke method activity.

  • TargetObject: ListOfJsonString
  • MethodName: Add
    Pass Parameters
  • Direction: In
  • Type: String
  • Value: JStr

Hope this solves your issue.

2 Likes

Hi @Anju_CP

The error happens because the list is not initialized- fix it by intialize pls
ListofJsonString = New List(Of String)
before using .Add(JStr).

Happy Automation

@Anju_CP

You can’t add list items using assign activity. Use Append Item to Collection Activity for this.

Make sure you initialize the listvariable before adding an item using ListofJsonString = New List(Of String)

1 Like

Hi @prashant1603765

Thank you for the response.

Initalization is already that was not the issue.

Thank you @MohammedShabbir ,

Invoke method resolved the issue.

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