How do I create a JSON string from an Array?



Hello, So I see plenty of examples on how to take an JSON string the bot got from another service and deserialize it into an array for it to process.

But I’m trying to go in the other direction. My bot has gathered various bits of information into an array and I want to encode that into a single JSON string that it can then pass out to the next service to handle.


Hi @Kit_Ramos

You could try to loop through your array and save the data following json syntax. It shouldn’t be that complicated.


Hi, @loginerror
Do you have any example of what you wrote?


Unfortunately, I do not have it on hand.

I did find a feature request with a suggestion on how to proceed:

You could use the JSONConvert.SerializeObject() from Newtonsoft.Json together with the Invoke Code activity.

I hope it sets you on the right track.