views:

62

answers:

1
System.Web.Script.Serialization.JavaScriptSerializer s = new System.Web.Script.Serialization.JavaScriptSerializer();
result = s.Deserialize<Hashtable>(data);

Error is thrown if data is "{a:\"\"test\" 123\",b:\"hello\" }" No error is thrown if data is "{a:\"test 123\",b:\"hello\" }" How do I adjust the data string so that no error is thrown even when there are quotes?

A: 

That shouldn't happen but try single quotes?

"{a:\"'test' 123\",b:\"hello\" }"

Or this:

'{a:"\"test\"" 123",b:"hello" }'
Razor Storm
I need test to be in double quotes though.
Prabhu
Then put the whole thing in single quotes. `'{a:"\"test\"" 123",b:"hello" }'`
Razor Storm