Added defensive style codes for retrieving the json data