extracting a json response in scrapy extracting a json response in scrapy json json

extracting a json response in scrapy


From the example given, it should be like this:

item["url"] = jsonresponse["records"][0]["uri"]item["Name"] = jsonresponse["records"][0]["name"]

EDIT:

To get all uris and names from the response, use this:

def parse(self, response):    ...    for record in jsonresponse["records"]:        item = ApiItem()        item["url"] = record["uri"]        item["Name"] = record["name"]        yield item

Note particularly replacing return with yield.