Introduced try-catch for `JSON.parse` as recommended by @jmeas