Added try/catch to the json object creation.