MS Edge change GET Response to application/json

Pavel Brokhman 6 Reputation points
2021-06-03T14:29:47.7+00:00

I recall that I could before REST API response result as JSON. Currently it shows me it as xml. Is there any settings in Edge browser that would help me to get Json instead Xml?

Microsoft Edge Microsoft Edge development
0 comments No comments
{count} vote

4 answers

Sort by: Most helpful
  1. Anonymous
    2021-06-04T06:54:55.29+00:00

    Hi @Pavel Brokhman

    When viewing a GET endpoint in a browser like Google Chrome, Firefox, or Microsoft Edge, the default Content-Type displayed in the browser is generally text/html in XML format. This is by design. I think what you should do is modify the code instead of trying to set the browser to solve it. You can use something like this :

    Content-Type: "application/json"  
    

    I found a good discussion on this issue, you can refer to it: How do I get ASP.NET Web API to return JSON instead of XML using Chrome?

    Content-Type is decided by the REST API, you can't change it in browser. If you want to see JSON, you need to change it in the REST API.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Regards,
    Yu Zhou


  2. Pavel Brokhman 6 Reputation points
    2021-06-04T17:57:29.307+00:00

    I know how to develop in different languages. It wasn't the question. My question is simple. I want to see JSON when I use REST API in browser's url, not XML. Is it possible?


  3. Pavel Brokhman 6 Reputation points
    2021-06-04T18:04:08.023+00:00

    Following is the example of what I see. As you see this is a feed using XML. I want the same but JSON.

    102516-image.png

    0 comments No comments

  4. Pawel 0 Reputation points
    2024-10-23T16:25:49.8733333+00:00

    I have the same question. API can implement multiple response formatters and it is up to the client to say what their preference is. Firefox requests JSON by default for example.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.