4

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,

2 Answers 2

10

Look at HttpUtility.UrlDecode in System.Web

Sign up to request clarification or add additional context in comments.

Comments

1

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/

1 Comment

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.