How to Validate JSON API Responses in Postman (Complete Guide)
Validate REST responses with pm.expect, JSON schema, JSONPath, and JMESPath. A step-by-step Postman guide with copy-paste snippets and a free JSON tester.
2026-07-17 · By Avinash Kamble, reviewed by Priyanka G.
Every mature API test suite validates three things about a JSON response: shape (schema), values (assertions), and contracts (types). This guide shows how to do all three in Postman without leaving the app.
1. Value assertions with pm.expect
const body = pm.response.json();
pm.test("status is 200", () => pm.response.to.have.status(200));
pm.test("first product name", () => {
pm.expect(body.data[0].name).to.eql("Widget");
});
pm.test("all prices are positive", () => {
body.data.forEach(p => pm.expect(p.price).to.be.above(0));
});2. Schema validation with ajv
const schema = {
type: "object",
required: ["id", "name", "price"],
properties: {
id: { type: "integer" },
name: { type: "string", minLength: 1 },
price: { type: "number", minimum: 0 }
}
};
pm.test("body matches schema", () => {
pm.response.to.have.jsonSchema(schema);
});3. Filter with JSONPath before asserting
const paid = body.orders.filter(o => o.status === "paid");
pm.test("we have exactly 3 paid orders", () => {
pm.expect(paid.length).to.eql(3);
});Prototype the JSONPath in the free JSON / JSONPath / JMESPath Tester, copy the working expression into Postman.
4. Data-driven runs
Use Postman's Runner with a CSV file to loop the same assertions across many payloads. Combine with the schema step above to catch contract regressions across environments.
5. Move complex assertions into code
Beyond ~10 assertions per request, prefer a real testing framework. Convert the collection to Playwright, Rest Assured, or k6 with the free Postman → Code Converter.
Frequently asked questions
1.How do I compare two JSON payloads in Postman?
2.Can Postman validate nested arrays?
3.How do I avoid duplicated test scripts?
4.What if the response is huge?
Practice these questions
Rehearse REST, Postman, REST Assured and contract-testing questions with worked examples.
Was this article helpful?
More from REST API Testing
REST fundamentals — verbs, status codes, contracts.
- Experience-Level QA InterviewsAPI Testing Interview Questions for 1 Year Experience (2026 Complete Guide)
- Experience-Level QA InterviewsAPI Testing Interview Questions for 3 Years Experience (2026 Complete Guide)
- Experience-Level QA InterviewsAPI Testing Interview Questions for Senior Level (2026 Complete Guide)
Keep building your QA edge
Pillar guides- Postman TutorialSoftwareTestPilot's Postman walkthroughPostman from zero to CI — collections, scripts, Newman.
- cURL to Code Converterconvert cURL to Postman, Playwright, or Rest AssuredConvert any cURL command to Postman, Playwright, Rest Assured, k6, Cypress, Python, and more — free, in-browser.
- JSON / JSONPath / JMESPath Testertest JSONPath and JMESPath side by sideDual-engine JSONPath + JMESPath tester with assertion builder and Postman/Playwright/Rest Assured export.
- Postman to Code Converterconvert Postman collection to PlaywrightConvert any Postman collection into a full Playwright, Rest Assured, k6, Cypress, Supertest, Python, or Karate test suite — folders, pm.test assertions, and environments preserved.
Practice these questions live
Rehearse with an AI QA interviewer that scores your answers in real time.
Continue reading
Join the QA Community
Connect with fellow testers, share job leads, and get career advice.
Stop Reinventing the Wheel. Upgrade Your QA Arsenal.
Take your testing skills from beginner to Lead Engineer. Supercharge your daily workflow with our premium digital resources.
- Ready-to-use testing strategy templates
- Advanced API & UI automation guides
- ⏱️ Save 10+ hours a week on test planning


