How to store class hierarchy so I can generate a tree most efficiently?
<pre><code>List&lt;myObject&gt; objects = new List&lt;myObject&gt;

myObject
{
    string a;
    string b;
}
</code></pre>

<p><code>a</code> holds the name of the <code>objects[i]</code>, and <code>b</code> holds the name of the parent of <code>objects[i]</code>.</p>

<p>How can I serialize this list to a file so I can later create a tree-like image?</p>

<p>As an example, <code>objects</code> list has four elements:</p>

<pre><code>{a=planet, b=solarsystem}, 
{a=moon, b=planet}
{a=solarsystem, b=universe}
{a=meteor, b=solarsystem}
</code></pre>

<p>I want to serialize this so I can later, using javascript, read the file and have enough information to generate this diagram:</p>

<p><img src="http://i.stack.imgur.com/w7x9x.png" alt="tree"></p>
