studio icon indicating copy to clipboard operation
studio copied to clipboard

how to define a array:json type variable?

Open dong-king opened this issue 1 year ago • 1 comments

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

dong-king avatar Jun 27 '24 09:06 dong-king

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

mvladic avatar Jun 28 '24 07:06 mvladic