Reputation: 29720
I have set up a WCF service. I have programmed the URL to be in the format:
http://localhost:64136/NewsProvider.svc/Rest/Getnews/1
When I set the return type to be XML I can change the number at the end of that link and browse the xml in a browser. However when I change it to JSON as soon as I hit the page in firefox I am asked do I want to download it?
How do I get round this and just view the pure JSON. When I used to write a page that wrote JSON I would add the following:
Response.Clear();
Response.ContentType = "text/plain";
Response.Write(json);
Response.End();
But I dont see how to change the content type and mess with the response object with WCF?
And will changing the content type actually let me just view the raw xml in the browser what govers this?
Upvotes: 2
Views: 277
Reputation: 364249
Yes firefox will offer you to open or download the content and if you do it you will see the passed JSON. If you don't like it you should install some Firefox extension (like JSONView) or HTTP proxy (like Fiddler).
Upvotes: 4