) at Home >
Article > Web Front-end > Things to note when converting string to json I have been working on a post for a day, sometimes it is normal and sometimes it is wrong! The above will report an error: That’s it! key and value must be in double quotes and comply with json specifications The above is the detailed content of Things to note when converting string to json. For more information, please follow other related articles on the PHP Chinese website!Things to note when converting string to json
let str = "{'name':'wanglei'}";
let obj = JSON.parse(str);
VM143:1 Uncaught SyntaxError: Unexpected token ' in JSON at position 1
at JSON.parse (<anonymous>)
at <anonymous>:1:6
str = '{"name":"wanglei"}';
Related articles
See more