I got the below response from a POST request and want to store the TOKEN value in an variable and use it for future use.
{"AccountName":"tester-01","token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCFtZSI6InN2Yy1kb2NwLXRlc3Rlcjkj5eWSZOSAExHVDL6V9_qgVOJ3pA","refreshvalue":"5X6g8QZ3rk1RWQXLdItXlKnfwTPGjQ==","validFrom":"2021-09-16T05:45:44Z","validTo":"2021-09-16T06:45:44Z"," refreshValidTo":"2021-09-16T11:45:44Z"}
The code snippet for the above response is
${body}= create dictionary username=test12345 password=12345
${header}= create dictionary Content-Type=application/json
${login}= post on session docp /login json=${body} headers=${header}
${value}= Set Variable ${login['token']}
When I try to set the response in the value variable I get the below error.
Resolving variable '${login['token']}' failed: TypeError: 'Response' object is not subscriptable.
Can someone please help.