JSON.parse( '{..}')で解析しようとするとJSONコードが発生します。 JavaScriptの に私はmatching.Pleaseは私が事前にit.Thanksを是正助けるエラーがブラケットであると考え、 "ILLEGAL予期しないトークン"JSONオブジェクトのJSON解析でエラーが発生しました
var obj= JSON.parse('{
\t "single": [
\t {"id": "1","question": "this is a question1?","option": ["option1","option2","option3","option4"]},
\t {"id": "2","question": "this is a question2?","option": ["option1","option2","option3","option4"]},
\t {"id": "3","question": "this is a question3?","option": ["option1","option2","option3","option4"]},
\t {"id": "4","question": "this is a question4?","option": ["optionu1","optionu2","optionu3","optionu4"]}
\t ],
\t "multiple": [
\t {"id": "1","question": "this is a multiple question1?","option": ["optionm1","option2lj","option3","option4"]},
\t {"id": "2","question": "this is a multiple question2?","option": ["optionm1","option2j","option3","option4"]},
\t {"id": "3","question": "this is a multiple question3?","option": ["optionm1","option2gg","option3","option4"]},
\t {"id": "4","question": "this is a multiple question4?","option": ["optionm1","option2h","option3","option4"]}
\t ],
\t "integer": [
\t {"id": "1","question": "this is a int question1?"},
\t {"id": "2","question": "this is a int question2?"},
\t {"id": "3","question": "this is a int question3?"},
\t {"id": "4","question": "this is a int question4?"}
\t ]}');
エラーを表示します。
'''文字をバッククォート 'で置き換えることはできますか? – Hackerman
それ以外の文字列の真ん中の改行は、私にはうまくいくようです – adeneo
私はプディングに証明があると推測します - > https://jsfiddle.net/9nrx7nsk/ – adeneo