studio
studio copied to clipboard
how to define a array:json type variable?
Describe the bug
there is a json type in eez-studio v0.14.2.
As shown in the figure below, I defined a array:json type variable. But when checking, an error message is displayed.
Indeed, this is a bug. But, when fixed you would need to set "Default value" as following:
[ json`{ "a": true, "b": 1 }`, json`{ "a": false, "b": 2 }` ]
In Default value field only literal values are allowed, so in this case you must use JSON literal, i.e. json`...` for each element.
But, you don't need to declare this variable as array:json, you can declare it as json as JSON value can also be an array. And you should set default value to:
json`[ { "a": true, "b": 1 }, { "a": false, "b": 2 } ]`