json with html value

Jan 16, 2013 at 11:28 PM
Edited Jan 16, 2013 at 11:30 PM

This don't work, any help?

 

 

string hj = @"{""data"": ""<a href=""www.google.com"">Google</a>""}";

            JObject o1 = JObject.Parse(hj);
Jan 17, 2013 at 1:30 PM
Edited Jan 17, 2013 at 1:31 PM

That doesn't look like valid JSON... the quotes within the value need to be escaped.

string hj = @"{""data"": ""<a href=\""www.google.com\"">Google</a>""}";
Jan 18, 2013 at 8:52 AM

Thanks for reply, but I receive the hj's string from webservice, How can I correct the received string to parse it correctly?

Jan 18, 2013 at 12:31 PM
babsevensix wrote:

Thanks for reply, but I receive the hj's string from webservice, How can I correct the received string to parse it correctly?

Not sure it'll be easy. Do you have access to this web service to fix it? Or perhaps ask the person responsible for the web service to do so? If the web service really does return invalid JSON it's a bug on their side.

Jan 20, 2013 at 9:36 AM
Edited Jan 20, 2013 at 9:36 AM

I have other application that work... I try fiddler and it work, it parse json correctly...

Jan 21, 2013 at 5:15 PM
babsevensix wrote:

I have other application that work... I try fiddler and it work, it parse json correctly...

Then perhaps you copied the JSON incorrectly when you pasted the initial example? Can you give an example of what the web service returns directly, using another tool?