Escape required characters for JSON

* JSON doesn't allow some characters in unescaped form in strings, so
  ensure these characters are escaped properly.
Fix setAttribute error

* CanJS doesn't like it when attributes are preceded by whitespace *and*
  wrapped by a helper -- it causes errors like:
    "' data-object-params' is not a valid attribute"
Merge pull request #1053 from reciprocity/feature/fix-json-issues

Fix JSON and attribute issues