Decoding JSON with simple array field

I have this json:

“account”: “xxxx”,
“rootFolder”: “Inbox\Actioned for Testing”,
“filepath”: “yyyy”,
“user”: “ALICE UAT”,
“warningEmails”: “tnnnn; jjjjj”,
“keyCAMs”: [“Person, A”, “Person, B”, “Person C”],
“emailDelay”: “00:00:20”,
“JSONDelay”: “00:00:20”,
“offTime”: “02/19/2019 17:00:00”

I can extract the values for each string field using deserialise json and an assign activity that looks like Config_Deserialised.item(“account”).Value(of string)

However, I need the keyCAMs field as an array of strings, and value (of string()) returns the error Assign: Cannot cast Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken.

How do I get this field into an array of strings? I use it for a contains check later, so would a long string be an easier solution?

Try this @SoqedHozi


this will give you the value inside the array

And how to I populate the array variable keyCAMs? I don’t know how many values it would contain.

Like this:

string_array = Config_Deserialised.item(“keyCAMs”).ToObject(of String())


Yes , you can assign the values to the array directly so that you can loop through that and use those values further as mentioned above @SoqedHozi

This works as I’d have hoped! Thanks

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