Closed Ayersss closed 4 years ago
When the {{var_name}}
syntax is used anywhere in the Request Body, the Beautify
feature doesn't change the JSON formatting in any way. It also gives the user no indication of the problem or the reason why it didn't work.
The user is just left clicking the button repeatedly and left wondering what happened.
If the {{var_name}}
syntax is wrapped in double quotes, then it will get formatted.
This can be seen in the .gif below:
Body
tab and the raw
typeapplication/json
from the dropdown option to set the header {
"hello": {{world}}
}
Beautify
buttonWhen using some basic sample code, you will notice the issue straight away but if the request body
is a relatively large JSON payload, that might have just a single {{var_name}}
somewhere, it might be harder to spot, as you wouldn't see it all in the Postman UI without scrolling.
[
{
"id": 1,
"first_name": "Sampson",
"last_name": "Dewerson",
"email": "sdewerson0@narod.ru",
"gender": "Male",
"ip_address": "114.134.166.86"
},
{
"id": 2,
"first_name": "Monika",
"last_name": "Newbury",
"email": "mnewbury1@bloglovin.com",
"gender": "Female",
"ip_address": "97.235.160.63"
},
{
"id": 3,
"first_name": "Town",
"last_name": "Oke",
"email": "toke2@timesonline.co.uk",
"gender": "Male",
"ip_address": "162.166.25.41"
},
{
"id": 4,
"first_name": "Egbert",
"last_name": "Stoddard",
"email": "estoddard3@wikimedia.org",
"gender": "Male",
"ip_address": "182.130.67.73"
},
{
"id": 5,
"first_name": "Ricoriki",
"last_name": "Fist",
"email": "rfist4@yolasite.com",
"gender": "Male",
"ip_address": "113.207.64.103"
},
{
"id": 6,
"first_name": "Griffin",
"last_name": "Mico",
"email": "gmico5@oracle.com",
"gender": "Male",
"ip_address": "2.39.65.30"
},
{
"id": 7,
"first_name": "Egbert",
"last_name": "Wishart",
"email": "ewishart6@apple.com",
"gender": "Male",
"ip_address": "136.110.196.122"
},
{
"id": 8,
"first_name": "Cosme",
"last_name": "Redborn",
"email": "credborn7@telegraph.co.uk",
"gender": "Male",
"ip_address": "210.90.253.18"
},
{
"id": 9,
"first_name": "Bronnie",
"last_name": "Conkie",
"email": "bconkie8@ft.com",
"gender": "Male",
"ip_address": "50.220.87.26"
},
{
"id": 10,
"first_name": "Iona",
"last_name": "Solon",
"email": "isolon9@wikipedia.org",
"gender": {{var_name}},
"ip_address": "145.64.3.219"
}
]
Postman Native Desktop App Version 7.1.1 MacOS
This issue shows the same problem - https://github.com/postmanlabs/postman-app-support/issues/6133
You only see the warning message in the Dev Tools console - This should probably be brought forward into the UI so the users are aware of a problem.
This issue has been resolved and works in the latest version of the app.
variable :sub_order_id=00011 { "merchant_id":{{merchant_id}}, "mobile":{{mobile}}, "sub_order_id":{{sub_order_id}}
} error:could not beautify
but: { "merchant_id":{{merchant_id}}, "mobile":{{mobile}}, "sub_order_id": "00011" } it is OK; why??????