Warning evaluating a JSON string.
I have an array of JSON strings. When the application try to evaluate them like
var x = eval(Posts[4])
where Posts is the array of JSON strings. I receive a warning dialog that ask me to kill the process or continue. The dialog says the following text.
"Calling eval() with anything other than a primitive string value will simply return the value. Is this what you Intended?"
If I click continue it will continue the execution of the application and works fine. Inclusive the eval() return the correct data even-though there was a warning.
Is there any way to remove that warning? Does I'm doing something wrong?
2 Answers
-
Try using
var x = JSON.parse(Posts[4]);
-
I solve my problem changing the way of the "JSON" arrray. Now is a Class array. This is the final code…
http://pastie.org/1155816