Moved JSON.Parse into try catch block