Crear html select con optgroup desde json

Tengo una cadena JSON (de php json_encode) que parece;

var json = [{"Foo":[{"id":1,"name":"aaa"},{"id":2,"name":"bbb"}]},{"Bar":[{"id":3,"name":"ccc"},{"id":4,"name":"ddd"}]}];

Quiero poder crear una selección html usando Javascript / jQuery en el formulario;

<select>
    <optgroup label="Foo">
        <option value="1">aaa</option>
        <option value="2">bbb</option>
    </optgroup>
    <optgroup label="Bar">
        <option value="3">ccc</option>
        <option value="4">ddd</option>
    </optgroup>
</select>

En cuanto al procesamiento del json me sale.tan lejos&nbsp;(No lo sé hasta ahora), pero jsFiddle no lo ejecuta y congela mi navegador.

var json = [{"Foo":[{"id":1,"name":"aaa"},{"id":2,"name":"bbb"}]},{"Bar":[{"id":3,"name":"ccc"},{"id":4,"name":"ddd"}]}];

$.each(json, function(i,group) {
&nbsp; &nbsp; console.log(i);
&nbsp; &nbsp; $.each(group, function(j, option) {
&nbsp; &nbsp; &nbsp; &nbsp; console.log(j, option);
&nbsp; &nbsp; &nbsp; &nbsp; $.each(option, function(k, item) {
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; console.log(k, item);
&nbsp; &nbsp; &nbsp; &nbsp; });
&nbsp; &nbsp; });
});​