Create select element from JSON

HTML

<div id="container"></div>

JavaScript

$(document).ready(function(){
    
    var jsonSelectElement='{"id":"testSelect","name":"testSelect","options":["value1","value2","value3"]}';
    
    var selectEl = jQuery.parseJSON(jsonSelectElement)
        $selectHtml = $("<select name='"+selectEl.name+"' id='"+selectEl.id+"'>");
    
    $.each(selectEl.options,function(index,value){
       $selectHtml.append('<option value='+index+'>'+value+'</option>');
    });
    //add select element to #container
    $selectHtml.appendTo($('#container'));
});