#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Checking JSON and XML Responses

Working with JSON Responses

JSON is the most common API response format. Postman automatically pretty-prints JSON in the response viewer, and pm.response.json() lets scripts parse it directly into a usable object for assertions.

Working with XML Responses

For APIs that return XML, Postman's response viewer can render it in a readable tree format. In scripts, xml2Json() can convert the XML body into a JSON-like object so it can be validated the same way.

Choosing the Right Checks

FormatParsing MethodCommon Check
JSONpm.response.json()Field values, structure
XMLxml2Json(pm.response.text())Element/attribute values

Content-Type Awareness

Checking the Content-Type header before parsing helps a test script handle both formats gracefully, especially when an API can return either one.

Once individual responses can be validated, the next step is linking multiple requests together by chaining them with scripts.

Ready to master Postman API Testing Course?

Join Uncodemy's hands-on training and build real-world API testing skills with expert mentors.

Explore Course