Can't get value from key when obj is imported

From: Peter (BOUGHTONP)11 Aug 2016 23:21
To: CHYRON (DSMITHHFX) 2 of 6
var picsObj = JSON.parse('{'+data+'}');
From: CHYRON (DSMITHHFX)12 Aug 2016 02:07
To: Peter (BOUGHTONP) 3 of 6
Thanks, I'll try it in the am.
From: koswix12 Aug 2016 13:19
To: CHYRON (DSMITHHFX) 4 of 6
Did it work?
From: CHYRON (DSMITHHFX)12 Aug 2016 13:48
To: ALL5 of 6
Seems to be working now. I had to stick the brackets in the external file & also change its single quotes to double, and switch .dayKey to [dayKey] in the script:
Code: 

    $.get('alldatestest.txt', function(data) {
        var picsObj = JSON.parse(data);
        alert(dayKey + ' ' + picsObj[dayKey]);
    });
- returns "0812 100315/5065359-R1-19-20_scaled.jpg"

This was also helpful: http://json.parser.online.fr/

Thanks Peter!

Edit: to clarify, here's the new "alldatestest.txt" -- I also had to wrap keys in quotes per above online parser:
 
Code: 
{"0810":"images/CNV00016-interim.jpg",
"0812": "100315/5065359-R1-19-20_scaled.jpg",
"1004": "100315/5065359-R1-19-20_scaled.jpg",
"1008": "images/CNV00016-interim.jpg"}
EDITED: 12 Aug 2016 14:18 by DSMITHHFX
From: CHYRON (DSMITHHFX)19 Aug 2016 17:07
To: ALL6 of 6
And now you can browse back and forth through the Daily Bad Pictures*, thanks to stack overflow and their diabolical spell
 
Code: 
Object.keys(obj).indexOf(key)


(you're not supposed to be able to do indexy stuffs on objects, but there you have it  (angel) )

http://www.designartcraft.com/photo/afbp.htm

*subject to buggery (NJ), breakage and general fail

EDITED: 19 Aug 2016 17:09 by DSMITHHFX