Home > Web Front-end > JS Tutorial > body text

JSON.parse solutions to string parsing errors_javascript skills

WBOY
Release: 2016-05-16 18:23:37
Original
1552 people have browsed it
JSON.parse solutions to string parsing errors_javascript skills
After investigation, it turns out that the format of json data is very strict, and the attribute name must be enclosed in double quotes "".

Copy code The code is as follows:

var a=JSON.parse('{ "a":"aaaaa"}');//Correct
var a=JSON.parse("{'a':'aaaaa'}");//Wrong
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template