title: Python 3 ... changing from using a dict to json
body: <p>I had my configuration in a dictionary that was imported in the form of (note this is an example, and not my actual code):</p>
  
  <p>myconfig.py</p>
  
  <pre class="lang-py prettyprint-override"><code>CONFIG_DICT = {
    'EMAIL1'             : 'fred.flintstone@gmail.com',
    'EMAIL2'             : '',
    'EMAIL3'             : '',
    'MIN'                : 21,
    'MAX'                : 28,
    'MAPPING'     : [("11", "AA"), ("22", "BB"), ("33", "CC"),("44","DD"),("55", "EE")],
   }
  </code></pre>
  
  <p>I would access that in my code with something like this:</p>
  
  <pre class="lang-py prettyprint-override"><code>    import myConfig.py
      email1 = myConfig.CONFIG_DICT.get( "EMAIL1" )
      email2 = myConfig.CONFIG_DICT.get( "EMAIL2" )
      email3 = myConfig.CONFIG_DICT.get( "EMAIL3" )
      min = float(myConfig.CONFIG_DICT.get( "MIN" ))
      max = float(myConfig.CONFIG_DICT.get( "MAX" ))
      mapping = myConfig.CONFIG_DICT.get(  "MAPPING" )
  
      def findName(ID):
          for i in range(len(mapping)):
              if mapping[i][0] == ID:
                  return(mapping[i][1])
          return("Unmapped")
  </code></pre>
  
  <p>That would all work quite well.
  I’ve now moved to putting all of these into a JSON file (for other reasons).   It all works OK apart from the 2D array</p>
  
  <p>Sample code:</p>
  
  <pre class="lang-py prettyprint-override"><code>    with open('myConfig.json', 'r+') as f:
          json_text = f.read() # for dictionary config
          f.seek(0)
  
          # Decode the JSON string into a Python dictionary.
          myConfig = json.loads(json_text)
  
      email1 = vchConfig["EMAIL1"]
      email2 = vchConfig["EMAIL2"]
      email3 = vchConfig["EMAIL3"]
      min = float(vchConfig["MIN"])
      max = float(vchConfig["MAX"])
      mapping = vchConfig[ "MAPPING"]
  </code></pre>
  
  <p>Now when I try to run, I get: <code>KeyError: 0</code></p>
  
  <p>I've tried various format changes in the json file, but I've gone around in circles</p>
  
  <p>Any help appreciated.</p>