I need to store a tree in a javascript object or array. There is one root element with N children. Each child can have N children, and so on. The last branch node holds a number. Real world example: Hats Child Blue -> 12 Green -> 23 Purple -> 31 Red -> 14 Adult Black -> 15 White -> 56 Gray -> 173 Code (markup): I think an associative array would be the best option, but I've read that they aren't supported. What is next best method for storing this type of data?
{ Hats : { child : { Blue : 12, Green : 23, Purple : 31, Red : 14 }, Adult : { Blac...etc, etc, } } } Code (markup): JSON; the next best thing since sliced bread.