05-30-2022 07:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-30-2022 07:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Hello,
I have a settings select item that looks like this:
<Select
label={`1`}
settingsKey="1"
options={[
{name:"Mathe"},
{name:"Deutsch"},
{name:"Französisch"},
{name:"Physik"},
{name:"Englisch"},
{name:"Informatik"},
{name:"Religion"},
{name:"Musik"},
{name:"Geschichte"},
{name:"Kunst"},
{name:"Chemie"},{name:"Biologie"},
{name:"Geografie"},
{name:"Sport"},
{name:"-"}
]}
/>
I want to save the index of the item that is selected in companion settings to a variable in companion/index.js
(Index of "Mathe" for example would be 0)
How can i do this, because a settingsStorage.getItem() on it returns
weird things like this:
'{"values":[{"name":"Deutsch"}],"selected":[1]}', '{"values":[{"name":"Informatik"}],"selected":[5]}', '{"values":[{"name":"Französisch"}],"selected":[2]}', '{"values":[{"name":"Physik"}],"selected":[3]}', '{"values":[{"name":"Englisch"}],"selected":[4]}', '{"values":[{"name":"Informatik"}],"selected":[5]}'
Thanks
Aaron
Answered! Go to the Best Answer.

Accepted Solutions
05-30-2022 13:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-30-2022 13:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
That's just a stringified JSON object. Convert it back to a JS object using JSON.parse(), then access whatever fields you want.
Gondwana Software
05-30-2022 13:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


05-30-2022 13:37
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
That's just a stringified JSON object. Convert it back to a JS object using JSON.parse(), then access whatever fields you want.
Gondwana Software
05-30-2022 20:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-30-2022 20:42
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thank you, i'll try it

