I am facing issue with the following Json reponse object in the javascript eval function;Getting java script error expected } because of special characters Tamás and Török
{
[{
"userFirstNm": "Naresh",
"userAsscId": "70336",
"userLastNm": "Yashwantrao",
"userLanId": "a70336"
}, {
"userFirstNm": "Tamás",
"userAsscId": "37732",
"userLastNm": "Török",
"userLanId": "a37732"
}]
}
Is there is any solution to resolve this problem.
Ah I know what the problem is. You need to wrap the object expression in parentheses for eval
to work correctly.
alert(eval("({\"userFirstNm\":\"Tamás\",\"userAsscId\":\"37732\",\"userLastNm\":\"Török\",\"userLanId\":\"a37732\"})"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With