Add a try-catch for JSON parsing