JSON array adding new values issue


I am trying to build a JSON, but the main issue is with the JSON array structure.

So the desired structure look like this:

“key1”: “sample string”,
“key2”: “sample string”,

“key3”: [
“key4”: “sample string 1”,
“key5”: “sample string 2”,
“key6”: “sample string 3”

“key4”: “sample string 1”,
“key5”: “sample string 2”,
“key6”: “sample string 3”

“key4”: “sample string n”,
“key5”: “sample string n”,
“key6”: “sample string n”


I just don’t find an answer of how could I add dynamically the values to “key 3” in the JSON array.

I am able to add them one by one with Invoke method, but it doesn’t help me because I need to add them in a FOR EACH statement.

Any response is appreciated.

Thanks in advance !

Cross reference:

We do have a few options, as also mentioned in the other thread:

  • constructing the Structure with the help of e.g. Dictionaries, Arrays… and convert it to JSON afterwards
  • Constructing JSON by the scratch

illustrating, from where the FOR EACH would be fed or what is sent in, would be helpful. Maybe a less generic sample data will let us better understand

However also have a look at this:

For each Activity | item in CollectionOfManyJObjects | TypeArguement: JObject

  • Invoke Code / Invoke Method
    • myJObject("key3").Value(Of JArray).Add(item)

Kindly note:

  • We answered into the direction of For Each, as it was asked for
  • It is also possible to create the JArray and populate it outside and store it at the end on the JObject under the Property “key” by:
    • Assign Activity: myJObject(“key3”) = MyOutSideConstructedJArray

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