简单json文件中的语法错误

时间:2021-06-10 22:42:12

I have a json file like this :

我有这样一个json文件:

["Sylvia Molloy","Manuel Mujica Lainez","Gustavo Nielsen","Silvina Ocampo","Victoria  Ocampo","Hector German Oesterheld", "Olga 
Orozco","Juan L. Ortiz", "Alicia Partnoy","Roberto Payro","Ricardo Piglia","Felipe  Pigna","Alejandra Pizarnik", 
"Antonio Porchia", "Juan Carlos Portantiero","Manuel Puig","Andres Rivera","Mario Rodriguez Cobos","Arturo Andres 
Roig","Ricardo Rojas"]

i am getting a syntax error in my browser console anyone knows why ?

我的浏览器控制台出现语法错误,有人知道为什么吗?

简单json文件中的语法错误

I have edited my json file to : ["SylviaMolloy","Bassemalam"] and i posted an image of the error please check again

我将我的json文件编辑为:["SylviaMolloy","Bassemalam"],并发布了错误的图片,请再次检查

3 个解决方案

#1


0  

In console you should not use new lines inside the strings. They are fine between array elements.

在控制台,不应该在字符串中使用新行。它们在数组元素之间很好。

#2


0  

Javascript strings cannot have line terminators literally. You have:

Javascript字符串不能有行终止符。你有:

"Arturo Andres //<-- line terminator here is illegal
Roig"

It should be

它应该是

"Arturo Andres Roig", ...

Or

"Arturo Andres\nRoig", ...

#3


0  

You should wrap the response between curly brances { } and give it a key so that it is a valid JSON: { "people" : ["Sylvia Molloy","Manuel Mujica Lainez"] }

您应该将响应包装在花括号{}之间,并给它一个键,以便它是有效的JSON:{“people”:[“Sylvia Molloy”,“Manuel Mujica Lainez”]}

#1


0  

In console you should not use new lines inside the strings. They are fine between array elements.

在控制台,不应该在字符串中使用新行。它们在数组元素之间很好。

#2


0  

Javascript strings cannot have line terminators literally. You have:

Javascript字符串不能有行终止符。你有:

"Arturo Andres //<-- line terminator here is illegal
Roig"

It should be

它应该是

"Arturo Andres Roig", ...

Or

"Arturo Andres\nRoig", ...

#3


0  

You should wrap the response between curly brances { } and give it a key so that it is a valid JSON: { "people" : ["Sylvia Molloy","Manuel Mujica Lainez"] }

您应该将响应包装在花括号{}之间,并给它一个键,以便它是有效的JSON:{“people”:[“Sylvia Molloy”,“Manuel Mujica Lainez”]}