Accessing nested data in dicts (JS example)
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 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.
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.
-- Pasted Max Patch, click to expand. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 779.3oc0W88aaBCD9Y3uBK+bVUvYwKYOstMotosJUo9XU0jShWJaINUDiZxp 5+6iZClCyOLAPYZRsAyYv999tOeb2y9d3E6Nv2iQuGcGxy6YeOOkoWM3kduG dK6vxMr8pGCK3OsawuvizSI4GjJyqBWJQefucAeEJHa1cwxMbo73ib8Nndpv cBVzQ7HD17O59zW3Qlb4Cgh0+HhuTpeGBM3hwiPDx6d8xb8MiuXr4cBWobfD m5MlM9m6DRAaqZawWFEx1jMiHdanHwoTfgjaT6pJquErH6C+iZQBHI6q17Jl jkxOoDjG9SIOJWHyLmY2C+0sKR16LyF6d3uDt9gb64S3gukIVy.SAlyC+QVT rXslYlNBkvEyT+5dbFeoWmaXBdTbZfmpdH8eyAi6qcz8lc7E+7cGeMSbLNpU XLYkl.VaGia.iZhH.PJMMtfm6WFC3q4qBi21y.nl6BH.hzwMM.vI0DH5q8SJ H5f099tm5IkQALh6wMPWA0.49ZuiZ9B9FAnFcOtHHsN7D.bXGiqQy6aCF7kG iQeKVDp2F6Da1gRPTt0Z+YEShQA3lBrOuThNZko6Jxt43rJvcSrLVhthuIV1 CzMSEflqbHy3VIYKNVyETE7lzh0YdMrld.oFdrabGHYXIs8yMJf9LewwDdD8 503SVEY4PiZReQK8MpNX2DAHpfvzBmx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