title: Fill a select with a JSON array
body: <p>I want to fill a selectbox with a JSON value in Spring. </p>
  
  <p>Using @ResponseBody, I have this JSON:</p>
  
  <pre><code>[{"id_raza":6,"raza":"Persa"},{"id_raza":7,"raza":"Egipcio"}]
  </code></pre>
  
  <p>I want to set the data in a selectbox such as</p>
  
  <pre><code>&lt;option value="6"&gt;Persa&lt;/option&gt;
  &lt;option value="7"&gt;Egipcio&lt;/option&gt;
  </code></pre>
  
  <p>How can I do it? I see examples with a no-array JSON, but my response is an array.
  <strong>Edit:</strong></p>
  
  <p>The complete code is:</p>
  
  <pre><code>$("#clase").change(function () {
      var razaSelected = $("#clase").val();
      alert("Raza Seleccionada: " + razaSelected);
      $.ajax({
         url: "${pageContext.request.contextPath}/persona/mascotas/raza/" + razaSelected,
         type: 'get',           
         dataType: 'html'
     }).done(function (data) {
         $('#raza').empty();
         data.forEach(function (obj) {
            $('&lt;option /&gt;', {value: obj.id_raza, text: obj.raza}).appendTo('#raza');
         });
  
     });
   });
  </code></pre>
  
  <p>Where <code>#raza</code> is the target select and <code>#clase</code> is the select to have the change event</p>
  
  <p>When I do <code>console.log(data)</code>, I get:</p>
  
  <pre><code>"[{"id_raza":6,"raza":"Persa"},{"id_raza":7,"raza":"Egipcio"}]"
  </code></pre>
  
  <p>Many thanks and sorry for my English</p>