Autocomplete Mapping JSON data

Autocomplete Mapping JSON data

I have successfully mapped some XML data to my auto completes. I used XML because it is more familiar to me, but i think i should be using JSON to be consistent with the way my shop develops.

Here is my function using XML:

  1. function (xmlResponse, callback) {
  2.         var data = $("STORE", xmlResponse).map(function () {
  3.             return {
  4.                 label: $("STORE_NO", this).text() + " - " + $("STORE_NAME", this).text(),
  5.                 value: $("STORE_NO", this).text()
  6.             };
  7.         }).get();

If i changed my webservice to return JSON, how would i do the identical thing? I think understanding this one example, will help me understand it in general and be able to apply what i learn here to different cases.