This is interesting. And by interesting, I mean, frustrating.
In my Run Javascript, I can pass JSON. I created a variable (Set Variable) with JSON. I named it orderJSON
Then I add the Run Javascript - the return variable is: testObject
var myJS =%orderJSON.length%
WScript.Echo(myJS)
The variable testObject is equal to the number of characters in the JSON.
However, the following:
var myJS = %orderJSON%
var jsLen = myJS.length
WScript.Echo(jsLen)
returns an error indicating the length property does not exist.
If I simply echo the %orderJSON% as the javascript output, testObject is the same text as orderJSON.
If I echo myJS (second example), testObject is an [Object].
Finally, if I attempt to use something like:
var newJS = Object.keys(%orderJSON%).length
WScript.Echo(newJS)
I receive the following error.
C:\Users\MattMoran\AppData\Local\Temp\Robin\0sptrkpjjft.tmp(2, 1) Microsoft JScript runtime error: Object doesn't support this property or method
I've also attempted to use JSON.parse() but it indicates that JSON is undefined.
My understanding of the capabilities and available functions and methods of JScript is an issue, I suppose.
As it turns out, for what I need to accomplish, I won't need this... but it is something I believe would be helpful. Any thoughts on what I've posted?