function escapeHtml (str) {
  return str
    .replace(/</g, '&lt;')
    .replace(/>/g, '&gt;')
    .replace(/\n/g, '<br>')
    .replace(/\s/g, '&nbsp;');
}
this function generates the json object tree view for all elements containing
 the given selector. The raw text to convert to json is taken from the previous element in
 the dom tree - e.g. on table column where row X-1 is the text to convert to json and row X
 is the selected element to add json object too

 @param {string} jsonSelector jquery selector to find all elements where json views should be added