added try catch for JSON.parse