Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dong-king opened this issue Jun 27, 2024 · 1 comment
Open

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

dong-king opened this issue Jun 27, 2024 · 1 comment
Assignees
Labels

Comments

@dong-king
Copy link

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
Copy link
Contributor

mvladic commented Jun 28, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants