Improved conditional expression for checking existence of JSON.stringify()