TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sam Hobbs
53
29.3k
2.1m
Formatting JSON for browser.storage.local.set
Nov 27 2018 10:20 PM
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.
Reply
Answers (
2
)
CSS triangles are formed by having height and width of
How to get value text value from javascript variable