Michael Christopher Martire Michael Christopher Martire - 2 months ago 6x
JSON Question

Accessing an odd object

How would I access the keys and values in the following...


This will be used for logging in. I am making a http post to a php backend.

I want to check if authenticated == true
I also want to be able to use the devid as well.

I know iterating through is an option but i know users@email.com will obviously be changing for every user.
So how can I access this dynamic object?


Do this:

var fileName='users@email.com{"authenticated":"TRUE","devid":"12334567890"}';
var str1 = fileName.split('{');
var str2 = str1[1].split('}');
var pos = JSON.parse('{'+str2[0]+'}');

pos.authenticated will contain your flag.