(SyntaxError): missing] after a list of items when using eval

I get the following error (SyntaxError): missing ] after element listwhen using a function eval. The returned JSON is pretty simple, so I don't know where the error is.

[{"title":"sfsdf","id":1}{"title":"m356","id":12}]
+2
source share
2 answers

As an answer for completeness. Your JSON is invalid. You need a comma between these objects:

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

First you lost the comma between the Object, the second jQuery will automatically parse the object. I suggest you not to use this method. I also answer this question, but there are some differences from yours.

0
source

Source: https://habr.com/ru/post/1609901/


All Articles