Accessing nested data in dicts (JS example)


    Nov 17 2011 | 10:52 am
    I can't tell if I'm trying to misuse dictionaries but I'd really like to use them to make nested data structures - something I've been doing rather awkwardly with pattr up until now.
    I can see a couple of other people on here are trying to do similar things and wondering if anyone has any advice. My biggest problem at the moment is finding a way to get information in without overwriting other entries - kind of along the lines of this http://cycling74.com/forums/topic.php?id=36243 but working with dicts inside dicts with a varying number of levels.
    I've attached a little bit of JavaScript I'm using to access the data - I'm very new to JS so there might be a better way of doing it but it seems to work. I hope it might be useful for someone.
    I have tried to do something similar in reverse (i.e. set level nextlevel value) but without any luck. I can post that up if anyone's interested in looking at my messy code.

    • Nov 17 2011 | 11:07 am
      Here's an example of some data I'm working with - starting to get a few more levels in now. JSON seems to be the best way to store this either way so I'm sorting out the structure by hand for the time being.