Nodejs Object to string issues

Hi, I’m trying to generate the some values using nodejs on ob2. In my case i need to generate the value on script 1 after make output of that result , i need to use of script 2.
Here is problem , my generated value will be on object type or array, i cannot able to make the output that directly so only option ob2 to output them as “string”. If i convert them into string i can’t able to use them in script 2.

Help me on this case or give some idea how to do on here !

BLOCK:Script
INTERPRETER:NodeJS
INPUT 
BEGIN SCRIPT
const { getRandomValues } = require("crypto")
var k= new Uint8Array(32)
var ran1=getRandomValues(k)
var ty= typeof ran1
END SCRIPT
OUTPUT String @ran1
OUTPUT String @ty
ENDBLOCK

BLOCK:Script
INTERPRETER:NodeJS
INPUT ran1
BEGIN SCRIPT
var ty2= typeof ran1
END SCRIPT
OUTPUT String @ty2
ENDBLOCK

@Pure

You can only pass around values in the types that OB2 supports. I suggest you serialize them to json and pass the json, then deserialize that.

1 Like