Iterating through list of keys for associative array in JSON
Posted
by Simon_Weaver
on Stack Overflow
See other posts from Stack Overflow
or by Simon_Weaver
Published on 2009-02-17T22:20:54Z
Indexed on
2010/06/15
2:42 UTC
Read the original article
Hit count: 249
JavaScript
|JSON
I have an associative array in JSON
var dictionary = {"cats":[1,2,37,38,40,32,33,35,39,36], "dogs", [4,5,6,3,2]};
Can I get the keys from this? I tried in Visual studio putting a breakpoint but can't see any property that represents keys. Is it not possible?
I'm fine creating a separate array if necessary, but was just hoping it wasnt :
var keys = ["cats", "dogs"];
© Stack Overflow or respective owner