How to generate mock json examples for postman collections
- Step 1Identify the response shape for each endpoint — Review the API contract or OpenAPI spec for each endpoint's response schema. This is the schema for generating the example.
- Step 2Generate a realistic example — Generate a single complete response example for the endpoint's primary success case. Use realistic values — not 'string' placeholders.
- Step 3Add the example to the Postman request — In Postman, open the request. Click 'Examples' →’ 'Add Example'. Paste the generated JSON as the response body. Set the status code and Content-Type: application/json header.
- Step 4Enable the Postman mock server — With examples saved for each request, click 'Mock Collection' in Postman. The mock server returns the saved example for each matching request — enabling API consumers to test against the mock before the real API is available.
Frequently asked questions
How does Postman's mock server decide which example to return?+
Postman matches incoming mock requests by HTTP method and URL path, and returns the saved example for that request. If multiple examples exist for a request, Postman returns the first matching example or the example matching a specific query parameter. Named examples can be targeted with the x-mock-response-name request header.
Should I add error response examples to the Postman collection?+
Yes. Add 400 (validation error), 401 (unauthorized), 404 (not found), and 500 (server error) examples for each endpoint. These document the full API surface and the mock server can return them when testing error handling in consumer applications.
Is the API design data transmitted to JAD Apps?+
No. Mock generation runs entirely in your browser. API design data and endpoint structures are never transmitted to JAD Apps servers.
Privacy first
Conversion runs locally in your browser. No file is uploaded — only metadata counters are saved for signed-in dashboard stats.