Skip to content
Software Testing Journal
Software Testing Journal

Your daily dose of learning!

  • Blog
  • Help Center
  • Video Playlist
  • Podcast & FAQ
  • Privacy Policy
Software Testing Journal

Your daily dose of learning!

Postman

Encode/Decode the variable/response using Postman itself

Dheeraj Gambhir, 2023-09-112023-09-11

We get a lot of use cases where we may have to implement Base64 encoding and/or decoding while building our APIs. And, if you are wondering if it is possible to encode/decode the variable/response using Postman itself or how to encode/decode the token or password in Postman and save it in a variable?

To Base64 encode/decode, the quickest way is to use JavaScript methods btoa, atob:

  • atob – It turns base64-encoded ASCII data back to binary.
  • btoa – It turns binary data to base64-encoded ASCII.

Sample code:

var responseBody = pm.response.json();

var parsedPwd = JSON.parse(atob(responseBody.password)); // presuming password is in the payload

pm.collectionVariables.set(“password”, parsedPwd);

If you find this post helpful, please share them with your colleagues and friends.

  • Facebook
  • Twitter
  • LinkedIn
  • Email
Automation APIPostmanTips

Post navigation

Previous post
Next post
©2025 Software Testing Journal | WordPress Theme by SuperbThemes