eez-open / studio

Cross-platform low-code GUI and automation
https://www.envox.eu/studio/studio-introduction/
GNU General Public License v3.0
299 stars 69 forks source link

how to define a array:json type variable? #430

Open dong-king opened 1 week ago

dong-king commented 1 week ago

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.

image

image

mvladic commented 1 week ago

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 } ]`