Skip to content

About

How to format the API response in POSTMAN

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 

Repository files navigation

postman_visualize

How to visualize or format the API response in POSTMAN.

Definitions:

To format the API response specific attribute in formatted view to unscape the special character (\n) newline.

Sample Response:

{"first_name":"shivansh\nsecond_value\nthird\nfourth_value\nfinal value","last_name":"seth"}

Data To format:

"first_name":"shivansh\nsecond_value\nthird\nfourth_value\nfinal value"

Expected Output:

image

Steps to write Tests in POSTMAN

Please follow the below steps to run the script.

Step-1 :

open postman and enter the API endpoint whose response you want to format/visualize.

image

Step-2 :

Select the 'Tests' tab

image

Step-3 :

Write the below script in "tests" tab

pm.visualizer.set("<pre>{{text}}</pre>", { text: pm.response.json().first_name });

Here first_name is the API response JSON attribute which we are formatting.

image

Step-4 :

Run the API "send' and see the formatted output in 'Visualize' Tab.

image

About

How to format the API response in POSTMAN

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors