Q: Not able to access token from response object via dot notation SSJS I am not able to access the token via dot notation (from response object) - what am I missing here?
Platform.Load("core", "1");

function requestToken() {
    var url = 'some_url';

    var payloadData = {
        grant_type: "client_credentials",
        client_id: "client_id",
        client_secret: "client_secret"
    };
    var payload = Platform.Function.Stringify(payloadData);

    var req = new Script.Util.HttpRequest(url);
    req.emptyContentHandling = 0;
    req.retries = 2;
    req.continueOnError = true;
    req.contentType = "application/json";
    req.method = "POST";
    req.postData = payload;

    var resp = req.send();
    Platform.Response.Write(resp.content); // Works good
    Platform.Response.Write(resp.content.access_token); // Seems like not working at all...
}
requestToken();


A: For some reason, SFMC will stringify some nested arrays or objects in the returns from API calls, so in order to pull data from it, you will need to turn them back into JSON objects.
You would do this via the SSJS Platform.Function.ParseJSON() function.
Like so:
Platform.Response.Write(Platform.Function.ParseJSON(resp.content).access_token);
