is an array of dicts possible?


    Aug 10 2014 | 12:42 pm
    trying to use dict for the first time, trying to get my head around it.
    I'd like to be able to construct an array of associations such as this: [ { "title": "Morning Playlist (a list of songs)", "start_time": 480, "end_time": 560, "items": [ { "title": "A song", "start_time": 28800, "duration": 180 }, { "title": "Another song", "start_time": 29000, "duration": 99 } ] } ]
    I know that lists are interpreted as arrays by dict, but what if you want dict {blocks} as elements of an array? anyone know how I'd go about this?

    • Aug 11 2014 | 12:48 am
      It appears I had some incompatability with the above structure, so here is a modification:
      {
      	"title" : "Morning Playlist (a list of songs)",
      	"start_time" : 480,
      	"end_time " : 560,
      	"items" : [ 		{
      			"title" : "A song",
      			"start_time" : 28800,
      			"duration" : 180
      		}
      , 		{
      			"title" : "Another song",
      			"start_time" : 29000,
      			"duration" : 99
      		}
       ]
      }
      
      I put the above text in a file, saved it with .json extension and it is able to be imported into [dict]. So it appears the dict object can recognize my desired structure. Can anyone show me how to construct such a structure (array of associative structures) from within max, using messages to dict? (ie how to make a list of dicts?)
    • Aug 12 2014 | 9:54 am
      hi here in this thread we exposed subdicts to a dict with registering them in a namespace https://cycling74.com/forums/how-you-build-your-dict-determines-how-you-can-access-it-why/ sorry i dont have Max here to patch it , but most of the stuff is covered inside this thread