Encode ' in json output

When an option was for an object, and that object had a property with a ' in it, the html that is written out is invalid. In the callback function when $(e.currentTarget).data("autocomplete") is used, some of the properties would end up undefined. Encode ' as &#39; when writing out the json value of an object.