[jQuery] Autocomplete: Multi-dim JSON array and Custom format

[jQuery] Autocomplete: Multi-dim JSON array and Custom format


Tried to post this question once before but didn't seem to work...
I'm needing to get a multi-dim JSON array to work for my autocomplete,
in an effort to mimic the Spotlight design.
My JSON currently looks like this:
[
{"key":"names", "values":[ bunch of values]},
{"key":"emails","values": [ bunch of email values ]}
]
I am wanting to put into an HTML structure like this:
<dl>
<dt>Names</dt>
<dd><a href="#">name</dd>
<dd><a href="#">name</dd>
<dt>Emails</dt>
<dd><a href="#">email</dd>
<dd><a href="#">email</dd>
</dl>
Basically, I want my JS to loop through the JSON array and spit out
the key into a <dt> tag, then each item into a <dd>. Easier said than
done.
Can anyone give me some direction? I've got it as far as listing all
the names and emails in <dd>'s, but no <dt>'s are happening...
Here is my adapted autocomplete.js code:
    function parse(data) {
        var parsed = [];
        $(data).each( function() {
            var rows = this.values;
            for (var i=0; i < rows.length; i++) {
                var row = rows[i];
                if (row) {
                    row = row.split("|");
                    parsed[parsed.length] = {
                        data: row,
                        value: row[0],
                        result: options.formatResult && options.formatResult(row,
row[0]) || row[0]
                    };
                }
            }
        });
        return parsed;
    };
Thanks.