I’ve been going around and around with this for hours and can’t seem to get it. I have a JavaScript function that produces a multidimentional object. I then convert it to JSON with JSON.stringify and pass it to my server connect with dmx.parse. I can’t for the life of me figure out how to access it properly in the server connect. I’ve done a simplified version below of the function.
Is this the right way to pass the JSON? And how do I access this on the server side? I’ve tried everything I can think of to no avail.
The stringified json looks like this…
[{“temp_1”:1,“temp_2”:2},{“temp_1”:2,“temp_2”:3},{“temp_1”:3,“temp_2”:4},{“temp_1”:4,“temp_2”:5},{“temp_1”:5,“temp_2”:6},{“temp_1”:6,“temp_2”:7},{“temp_1”:7,“temp_2”:8},{“temp_1”:8,“temp_2”:9},{“temp_1”:9,“temp_2”:10},{“temp_1”:10,“temp_2”:11}]
Thanks in advance for any help!
function create_array(){
var my_array = [];
var x;
var y;
for(let i = 0; i < 10; i++){
my_array[i] = {
temp_1: i + 1,
temp_2: i + 2
}
}
var my_new_array = JSON.stringify(my_array);
dmx.parse("serverconnect1.load({my_array:'" + my_new_array + "'})");
}
Last updated: