views:

170

answers:

2

Hi ,

I have a string which looks like this '%7B%22id%22%3A1%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,

+6  A: 

Look at HttpUtility.UrlDecode in System.Web

mjmarsh
+1  A: 

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/

Phil Strong
+1 Thank you. This answers my other question posted here: http://stackoverflow.com/questions/2178821/parsing-json-objects-to-c
nav