Search code examples
javascriptjsonpostman

Postman Get response in a variable - Special character


Taking into account the result of a POST request

{
    "<Id>k__Field": "ac12432e-b1fb-4c46-9aed-9d7e246bf613"  
}

the special characters "<", ">" come with the response of the request.

I need to get this result in a variable inside Postman:

code

But it is throwing an error.

How can I get the value in a correct way?


Solution

  • Looks like you should just omit Id altogether as it isn't in the JSON.

    var id = jsonData.k__Field;

    Also <Id> is not valid JS syntax

    You should use:

    var id = jsonData["<Id>k__Field"];