How to store different structures in a structure

Well it almost seems like you are recreating a relational database with this

Attributes would be a second set of struct with a parent child relationship.

Attribute would need to contain the parents id (its foreign key).