title: Set form inputs based on json object
body: <p>In my code I have a JSON serialized dictionary like so:</p>
  
  <pre><code>{ BackgroundColor="F4F4F4", ShowTitle=true, NumberToShow=10}
  </code></pre>
  
  <p>I need to set the values of matching form fields (using the property key).</p>
  
  <p>Here's how I'm doing it currently:</p>
  
  <pre><code>    function applyPreset(preset) {
          for (var prop in preset) {
              var $container = $("div#attribute-" + prop);
              $("input", $container).val(preset[prop]);
          }
      }
  </code></pre>
  
  <p>This works fine for textboxes but obviously doesn't work for radio checkboxes or select lists.</p>
  
  <p>I wondered if there were any clever functions in jQuery to do this or should I just loop through each input, check it's type and set the value accordingly?</p>