[JQueryUI] Autocomplete with JSON: API documentation contains error in example

[JQueryUI] Autocomplete with JSON: API documentation contains error in example

Hi all,

spent an afternoon yesterday to try to get autocomplete to work, with a Java servlet as source.

I used the JSON example from the API documentation:
http://api.jqueryui.com/autocomplete/#option-source

It states you can use the following JSON for example:
  1. [ { label: "Choice1", value: "value1" } ]

I tried it out and my autocomplete script didn't work; firebug didn't find JavaScript errors, so I was at a loss as to what was wrong...

Finally I found out in a stackoverflow.com post that this example actually isn't well formed JSON, and doesn't work!

It should read:

  1. [
  2.   {
  3.     "label": "Choice1",
  4.     "value": "Value1"
  5.   },
  6.   {
  7.     "label": "Choice2",
  8.     "value": "Value2"
  9.   }
  10. ]
When not sure if your JSON is valid, you can run it through this site: http://jsonlint.com/