I want to use browser.storage.local.set in a Firefox sidebar extension. I am just new to JSON. I know many computer languages and formats but JSON is so much different from other things.
I just want to store a Model with an Id such as SKU1065 and a default Rating of 0 and empty Comments. So I think I want:
- {SKU1065: {Rating:0, Comments:""}}
But the following is not working.
- var Model = '{"' + CurrentId + ': {Rating:0, Comments:""}}';
- browser.storage.local.set(Model);
When I run that code, browser.storage.local.set says it (Model) is not valid.
I hope this is very easy for many of you and if so I hope you don't mind providing an answer.