(SyntaxError): missing ] after element list when u

2019-05-28 21:41发布

问题:

I get following error (SyntaxError): missing ] after element list when using eval function. Returned JSON is pretty simple, so I don't undestand where is error.

[{"title":"sfsdf","id":1}{"title":"m356","id":12}]

回答1:

As an answer for completeness. Your JSON is invalid. You need a comma between the Objects like so:

[{"title":"sfsdf","id":1},{"title":"m356","id":12}]


回答2:

First you have lost the comma between the Object,the Second Jquery will parse the Object automaticly. i suggest you don't use this method. i also meet thie question,but there're some difference from yours.