Parsing responseBody string dictionaries?

Hello, I have been looking for an answer few hours now :frowning: so I will ask it here. My goal is to set environment variable from responseBody so I could reuse it later on in other requests. Before I do that I want to first fetch that variable, however I encounter issues.

{
"email":"test_email",
"tokens":"{'refresh': 'sample_refresh', 'access': 'sample access'}"
}

Please note that tokens is another dict, but passed as string
I want to get the value for access.
and here are what I have tried doing:

response = JSON.parse(responseBody);
tokens = response.tokens
accesstry1 = tokens["access"]
accesstry2 = tokens[1]

console.log(tokens)
Result: "{'refresh': 'sample_refresh', 'access': 'sample access'}"
console.log(accesstry1)
Result: undefined
console.log(accesstry2)
Result: "'"

I also tried to re-parse tokens like this:

tokens = response.tokens 
tokens_parsed = JSON.parse(tokens)
Result JSONError: Unexpected token '\'' at 1:2 {'refresh': 
       'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVza

Please help :slight_smile: