-2

Taking into account the result of a POST request

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

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?

DanielV
  • 2,076
  • 2
  • 40
  • 61
  • 1
    what s the `` supposed to be, both logically and syntactically? – luk2302 May 31 '21 at 08:53
  • comes in the response, for some reason the editor was omiting it, I have added blank spaces to clarify – DanielV May 31 '21 at 08:56
  • After the edit this is a duplicate of [Accessing json keys with special characters](https://stackoverflow.com/questions/24818524/accessing-json-keys-with-special-characters-in-javascript) – luk2302 May 31 '21 at 08:56
  • I don't see the relation with the reference, please clarify – DanielV May 31 '21 at 08:58
  • `<` is a special character. The linked question is an ***exact*** duplicate. – luk2302 May 31 '21 at 09:02

1 Answers1

2

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"]; 
DanielV
  • 2,076
  • 2
  • 40
  • 61
Jake C
  • 136
  • 5