So I'm currently adapting a python-based GUI to a javascript based web GUI. The program sends large JSON messages to some server for processing. The server recieves messages in which some values are set like so:
"someVar": []
However, I don't know how to send this in the same way from my own GUI in javascript. My solutions result in this:
"someVar": null
The server doesn't like this, but I cannot find a way to assign an empty array without it defaulting to null.
The object starts out like so:
{
var1: null
var2: "someString"
var3: 1.3
...
}
when the server gets this, it normally prints out
{
var1: []
var2: "someString"
var3: 1.3
...
}
so lets say this object is stored in a variable called curConfig
I want to do something like this:
curConfig['var1'] = []
But that still leaves me with a null value instead of [] when it gets sent to the server.
[]as the initial value of the array, and then push new elements into it?nullfor some reason.