def parseJSON(self, response): data = json.loads(response.body) if data and data['offers'] and len(data['offers']) != 0: c = csv.writer(open("offers2.csv", "wb")) writeOfferItemHeaderRowCSV(c) for offer in data['offers']: item = OfferItem() item['offer'] = offer['id'] item['title'] = offer['title'].encode('utf8') item['country']= offer['country'].encode('utf8') item['location_name']= offer['city'].encode('utf8') item['postal_code']= offer['postal_code'].encode('utf8') item['education_level']= offer['study_level'].encode('utf8') item['experience_level']= offer['experience'].encode('utf8') item['contract_type']= offer['contract_type'].encode('utf8') item['job_description']= offer['description'].encode('utf8') item['profile_description']= offer['requested_profile'].encode('utf8') item.writeRowCSV(c)