try { JSON.parse(input); } catch (e) { return undefined; // Or whatever action you want here }
var textarea = data.replace(/( | | )/gm, "")