0

I'm getting the following JSON response:

"Nitro": {
    "Login": {
        "sessionKey": "NHwxNDQ4MzR8MzY1ODE5ODMwMnwxMzQ0NzE5MTYyfDgxY2M1NjYxZDBiY2NiODI4NmM2Mjc1ODI2MzA1NDY3YmVhNzJjZDR8MA=="
    },
    "res": "ok",
    "method": "user.login",
    "server": "sbnitro01.prod.bunchball.net/nitro4.4.0"
}
}

I don't understand how to parse this with JavaScript and store the value of the sessionKey in a variable. I cannot use jQuery on this project and just cannot seem to get the key with JS.

Thanks!

Colin Brock
  • 21,267
  • 9
  • 46
  • 61
RkH
  • 15
  • 3

1 Answers1

0

Try:

var sessionKey = obj.Nitro.Login['sessionKey'];

This takes the object that is stored in the obj variable, then takes the Nitro property object and then takes the Login property object and extracts the property sessionKey accordingly.

Robert
  • 8,717
  • 2
  • 27
  • 34