String formatting c# decode?
I have a string which looks like this '%7B%22id%22%3A开发者_如何学Python1%2C%22name%22%3A%22jim%22%7D'
When read from a cookie it is in fact a JSON object and should look like {"id":1,"name":"jim"}
Do I need to HTML decode the string to make it appear in the correct JSON notation?
Thanks,
Look at HttpUtility.UrlDecode in System.Web
Also assuming your using .Net 3.5 check this article by ScottGu and follow up from Scott Longnecker that allows you to convert c# classes to json and viceversa.
http://tiredblogger.wordpress.com/2007/10/03/to-and-fromjson-extension-methods/
精彩评论