Script for backward-compatibility: https://github.com/douglascrockford/JSON-js/blob/master/json2.js
And call:
var myJsonString = JSON.stringify(yourArray);
Note: The JSON object is now part of most modern web browsers (IE 8 & above). See caniuse for full listing. Credit goes to: @Spudley for his comment below
Answer from JonoW on Stack OverflowScript for backward-compatibility: https://github.com/douglascrockford/JSON-js/blob/master/json2.js
And call:
var myJsonString = JSON.stringify(yourArray);
Note: The JSON object is now part of most modern web browsers (IE 8 & above). See caniuse for full listing. Credit goes to: @Spudley for his comment below
I made it that way:
if I have:
var jsonArg1 = new Object();
jsonArg1.name = 'calc this';
jsonArg1.value = 3.1415;
var jsonArg2 = new Object();
jsonArg2.name = 'calc this again';
jsonArg2.value = 2.73;
var pluginArrayArg = new Array();
pluginArrayArg.push(jsonArg1);
pluginArrayArg.push(jsonArg2);
to convert pluginArrayArg (which is pure javascript array) into JSON array:
var jsonArray = JSON.parse(JSON.stringify(pluginArrayArg))
Javascript array to JSON
JavaScript array to JSON - JavaScript - SitePoint Forums | Web Development & Design Community
Cannot access fields from a json array object with javascript
Convert Array to JSON String
Can you please explain what's going on with the Iterator -> Array Aggregator logic.
From your description I am guessing:
-
that you have multiple bundles coming in to your Iterator.
-
the Iterator then iterates the list of items contained in each bundle.
-
You are trying to get an aggregated array of all items across all bundles
I suspect that your Iterator is an extra step that is getting in the way. I will say that in the past I have had similar frustrations trying to do transforms like this. Integromat's model is more event driven and does not lend itself well to creating ad-hoc lists and then iterating over them.
If my assumptions above are correct, I think you need to get rid of the Iterator and just go straight from your output module to the Array Aggregator.
There is also an "Aggregate to JSON" module that might help you.
If that doesn't solve it, please say more about what you are trying to do.
More on reddit.com