Get the Response in Mock Server
Here we will discuss how to get the response in other different formats in Postman, which is very easy. The most common format is JSON. Let's see how to get the response in JSON format.
- From the top left corner in the Header section of the Postman app, select the New
- Once you select the Mock server, a new panel will be opened. Through this panel, we can create a new request.
- In the Response Body column, instead of writing plain text, enter the response body in JSON format.
Here, we will write the data about different Employees:
Copy the above JSON in the Response body.
- Press Next. Now in the next panel, give the name of the server as per your choice. I gave 'JSON Response'.
- Select on Create Mock Server button.
- Select the Employee API and then select the JSON Response environment.
- Press send and see the response.
Here, you might get the response in HTML format by default, change the format to JSON from the dropdown, and you will get the response as given above.
Similarly, we can use different formats to get the response in a mock server.