title: How to extract data in one FOR loop from JSON multiple dictionary - Python
body: <p>In my scrapy project I want to extract data from a website. It turned out that all information are stored in some script that I can easily read in JSON format and from there extract the data I need.</p>
  <p>That's my function:</p>
  <pre><code>    def parse(self, response):
          items = response.css(&quot;script:contains('window.__INITIAL_STATE__')::text&quot;).re_first(r&quot;window\.__INITIAL_STATE__ =(.*);&quot;)
          for item in json.loads(items)['offers']:
              yield {
                  &quot;title&quot;: item['jobTitle'],
                  &quot;employer&quot;: item['employer'],
                  &quot;country&quot;: item['countryName'],
                  &quot;details_page&quot;: item['companyProfileUrl'],
                  &quot;expiration_date&quot;: item['expirationDate'],
                  'salary': item['salary'],
                  'employmentLevel': item['employmentLevel'],
              }
  </code></pre>
  <p>And json file have that structure:</p>
  <pre><code>var = {
      &quot;offers&quot;:[
        {
          &quot;commonOfferId&quot;:&quot;1200072247&quot;,
          &quot;jobTitle&quot;:&quot;Automatyk - Programista&quot;,
          &quot;employer&quot;:&quot;MULTIPAK Spółka Akcyjna&quot;,
          &quot;companyProfileUrl&quot;:&quot;https://pracodawcy.pracuj.pl/company/20379037/profile&quot;,
          &quot;expirationDate&quot;:&quot;2021-04-28T12:47:06.273&quot;,
          &quot;salary&quot;:&quot;&quot;,
          &quot;employmentLevel&quot;:&quot;Specjalista (Mid / Regular)&quot; ,
          &quot;offers&quot;: [
                  {
              &quot;offerId&quot;:500092126,
              &quot;regionName&quot;:&quot;kujawsko-pomorskie&quot;,
              &quot;cities&quot;:[&quot;Małe Czyste (pow. chełmiński)&quot;],
              &quot;label&quot;:&quot;Małe Czyste (pow. chełmiński)&quot;}], 
  </code></pre>
  <p>Above example of one element. So when I try to extract data like cities or regioName I receive an error. How can I make for loop from throughout two dictionaries and yield that data date to the new dictionary?</p>