title: Assign JSON to autocomplete
body: <p>I have the following string representation of an actual JSON object returned from my service:</p>
  
  <pre><code>[
    {
      "label": "#1 Pizza [99999]",
      "value": "99999"
    },
    {
      "label": "001 Test Facility [99998]",
      "value": "99998"
    }
  ]
  </code></pre>
  
  <p>I am trying to put this in a jQuery autocomplete.  But I don't have a clear idea why I don't see the data in that control.</p>
  
  <p>I have looked all over for this and asked other questions.  I have been working on this for DAYS and I am SO close so please help....</p>
  
  <p>Here is my markup/script</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  function processFacilities(data) {
      response($.map(data, function (value, key) {
          alert(data);
          return {
              label: value,
              value: key
          };
      }));
  };
  
  $('#tags').autocomplete({
      source: function (request, response) {
          $.getJSON('FacilitiesAsync', 'sourceDb=myDb', processFacilities);
      },
      minLength: 2,
      delay: 100
  });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>My class is returning the label and value as I saw was needed from the post below.  What is different here is that my JSON data does not have something in front of it to identify it, for example: ["facilities": {etc...}]</p>
  
  <p><a href="https://stackoverflow.com/questions/11435433/jquery-ui-autocomplete-with-json">jQuery UI autocomplete with JSON</a></p>