src/utils.js
function parseJson(text) {
  try {
    var o = JSON.parse(text);
    if (o && typeof o === "object" && o !== null)
      return o;
  }
  catch (e) {}

  return text;
}
function parseJson(text) {
  try {
    var o = JSON.parse(text);
    if (o && typeof o === "object" && o !== null)
      return o;
  }
  catch (e) {}

  return text;
}
function parseJson ( text ) { try { var o = JSON . parse ( text ) ; if ( o && typeof o === "object" && o !== null ) return o ; } catch ( e ) { } return text ; }
Return parsed JSON if needed, otherwise returns text as is.
@source http://stackoverflow.com/a/20392392/371699
@param text
Return parsed JSON if needed otherwise returns text as is .