简体   繁体   中英

JSON error: Expecting … got 'undefined'

What is the error in this JSON code?

{
  “status”: ”Completed”
}

Error: Parse error on line 1: '{ “status”: ”Compl ^

Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'

你可能使用两个倒置引号而不是双引号,这很好用

JSON.parse( '{ "status": "Completed" }' );

Put Your code here online json parser

Look at the Quotes

Your Code

{ “status”: ”Completed” }

Correct Code

{ "status": "Completed" }

The char is the problem. ASCII code for this is 8221 .

Use double inverted quotes and it will work just fine:

{ "status": "Completed" }

Note : These kind of error comes when we try to copy json from doc files or any other format files. Beware!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM