title: print All the keys of a json file in python
body: <p>I have a folder where I have around 20000 JSON files. I want to find out all the unique keys of each JSON and I want take an union of all the keys. However, I got stuck in the initial step only. I am able to find the keys of a single JSON file.</p>
  
  <p>I have wrote the following code till now:</p>
  
  <pre><code>from pprint import pprint
  import json
  json_data=open("/Users/akira/out/1.json")
  jdata = json.load(json_data)
  
  for key, value in jdata:
     pprint("Key:")
     pprint(key)
  </code></pre>
  
  <p>It is giving me an error as follows:</p>
  
  <pre><code>Traceback (most recent call last):
   File "/Users/akira/PycharmProjects/csci572/linkedbased.py",     line 8, in &lt;module&gt;
     for key, value in jdata:
   ValueError: need more than 1 value to unpack
  </code></pre>
  
  <p>My JSON is a nested json. Please suggest me how can I get all the keys.</p>
  
  <pre><code>{
  "a": "Offer",
  "inLanguage": "et",
  "availabl": {
      "a": "Place",
      "address": {
          "a": "PostalAddress",
          "name": "Oklahoma"
      }
  },
  "description": "Smith and Wesson 686 357 magnum 6 inch barrel wood handle great condition shoots great.",
  "priceCurrency": "USD",
  "geonames_address": [
      {
          "a": "PopulatedPlace",
          "hasIdentifier": {
              "a": "Identifier",
              "label": "4552707",
              "hasType": "http://dig.isi.edu/gazetteer/data/SKOS/IdentifierTypes/GeonamesId"
          },
          "hasPreferredName": {
              "a": "Name",
              "label": "Tahlequah"
          },
          "uri": "http://dig.isi.edu/gazetteer/data/geonames/place/4552707",
          "fallsWithinState1stDiv": {
              "a": "State1stDiv",
              "uri": "http://dig.isi.edu/gazetteer/data/geonames/place/State1stDiv/US_OK",
              "hasName": {
                  "a": "Name",
                  "label": "Oklahoma"
              }
          },
          "score": 0.5,
          "fallsWithinCountry": {
              "a": "Country",
              "uri": "http://dig.isi.edu/gazetteer/data/geonames/place/Country/US",
              "hasName": {
                  "a": "Name",
                  "label": "United States"
              }
          },
          "fallsWithinCountyProvince2ndDiv": {
              "a": "CountyProvince2ndDiv",
              "uri": "http://dig.isi.edu/gazetteer/data/geonames/place/CountyProvince2ndDiv/US_OK_021"
          },
          "geo": {
              "lat": 35.91537,
              "lon": -94.96996
          }
      }
  ],
  "price": 750,
  "title": "For Sale: Smith &amp;amp; Wesson 686",
  "publisher": {
      "a": "Organization",
      "name": "armslist.com",
      "uri": "http://dig.isi.edu/weapons/data/organization/armslist"
  },
  "uri": "http://dig.isi.edu/weapons/data/page/13AD9516F01012C5F89E8AADAE5D7E1E2BA97FF9/1433463841000/processed",
  "seller": {
      "a": "PersonOrOrganization",
      "description": "Private Party"
  } //, ...
  }
  </code></pre>