I need to eval an JavaScriptSerializer() object.
var userSettings = '<%= new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(ViewData["UserSettings"]) %>';
The above line gives the output as:
{"SalesTaxPercentage":7.75,"StartOfWeek":"SUNDAY","NoofRowsInList":10,"ShowDashboardEntry":5,"DisplayContactsFormat":"LastName, FirstName","FooterNotes":""When you look good, you feel good...when you feel good, your attitude changes...and attitude is everything!"
You are the heart of my business....THANK YOU!"}
When i use eval for the serialized content like:
userSettings = eval("(" + userSettings + ")");
It throws an error:
missing } after property list
This is because of the special characters in the serialized object (in FooterNotes with " and some other characters in between start and end quotes) during eval.
How can i remove the special characters in serialized before eval?
Or how can i get the value of SalesTaxPercentage
from searialized object?