Added a try/catch block around creating new objects to protect against invalid JSON