Dictionary in dictionary, Push to Coll, saving with different suffix
Hello,
Ultimately, I am looking for a way to save my dictionary with a different suffix as the default .JSON
Since 'dict' couldn't do the task and 'coll' can, I found out that I have to go the 'coll' way. I managed to push the information from my dict to a coll. But... I have sub-dictionaries in my main dictionary and do not know how I can get this data saved in my coll as well. Anyone?
Does anyone have an answer to this? I am now parsing .json dictionaries to COLL that have sub dictionaries and, whilst COLL lists the parent dictionary, it doesn't unpack the sub-dictionaries. Does anyone know how to parse ALL dictionaries and sub-dictionaries to COLL form .json files?
Many thanks.
I strongly suspect this is not possible. For one simple reason: coll is a flat data structure, it has no capacity to represent nested structures. The only way you could do it is to create a heirarchy of colls that reflect the structure of your json data, with a different coll for each (sub-)dictionary, and have a parent coll that refers to the "sub-colls". I suspect this is not the way you'd want to go, as you'd have to design a whole process to parse the data, and use scripting to create and dispose of colls as the data is parsed/changed.
Long outdated, but: I have done this on many occasions, especially in standalones.
The way to go for me is using the text object to which a serialised dictionary can be submitted as raw JSON-text and then saved with any preferred suffix imaginable. Enabling max to recognise the special suffix and associate it with dictionaries (i.e. JSON) it requires a corresponding message to Max, either on load or in an objectmappings.txt textfile.
See attached patch.
Appendix: using coll may work but to my knowledge nested dictionaries cannot be pushed to coll losslessly. text has worked reliably.

let me know if there is a problem and I am happy to look at it. You could use TEXT as file format as well me reckons.
Greetz, Tim