# Parsing response value of X-XSRF-TOKEN to envinronment varable

**URL:** <https://community.postman.com/t/parsing-response-value-of-x-xsrf-token-to-envinronment-varable/37884>\
**Category:** Help Hub\
**Tags:** json\
**Created:** [August 4, 2022, 2:33pm UTC](https://community.postman.com/t/parsing-response-value-of-x-xsrf-token-to-envinronment-varable/37884 "2022-08-04T14:33:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivdouden](https://avatars.discourse-cdn.com/v4/letter/i/5f8ce5/32.png) [@ivdouden](https://community.postman.com/u/ivdouden)\
**Post date:** [August 4, 2022, 2:33pm UTC](https://community.postman.com/t/parsing-response-value-of-x-xsrf-token-to-envinronment-varable/37884/1 "2022-08-04T14:33:59Z")

</div>

I’m trying to get value of X-XSRF-TOKEN to environment variable  
But i keep getting There was an error in evaluating the test script: JSONError: Unexpected token ‘E’ at 1:1 ECB9869521CA0FE219335DA9C0A5EB886E0D1CA7972DC2DF23B2E3441D57B2631ACA8048377396D ^

Test script is :  
let responseData=pm.response.json();  
console.log(responseData);  
pm.environment.set(“X-XSRF-TOKEN”, responseData.resources.name);

The code to get the token is :  
https://{{vmanage}}:{{port}}/dataservice/client/token on a cisco vmanage controller.

---

<div class="post-metadata">

**Author:** ![ivdouden](https://avatars.discourse-cdn.com/v4/letter/i/5f8ce5/32.png) [@ivdouden](https://community.postman.com/u/ivdouden)\
**Post date:** [August 5, 2022, 6:03am UTC](https://community.postman.com/t/parsing-response-value-of-x-xsrf-token-to-envinronment-varable/37884/2 "2022-08-05T06:03:45Z")

</div>

I solved the issue i was having, i changed the test to the following :

let ResponseData = pm.response.text()  
pm.environment.set(“X-XSRF-TOKEN”, ResponseData);

Now the token is parsed correctly and the X-XSRF-TOKEN is filled with the correct value
