title: Convert "True" to true JSON Python
body: <p>Im reading json which has a boolean. When loading the file in Python with <code>json.load()</code>, I get <code>True</code> (I've read the specs).</p>
  
  <pre><code>{"XYZ": true}
  </code></pre>
  
  <p>As I understood I need to use <code>json.dumps()</code> to handle this. My dumps look like this.</p>
  
  <pre><code>convert = json.dumps({"true": True, "false": False})
  </code></pre>
  
  <p>And my load like this:</p>
  
  <pre><code>jdata = json.load(open(json_path))
  </code></pre>
  
  <p>When printing <code>jdata</code> I get: </p>
  
  <pre><code>{u'XYZ': True}
  </code></pre>
  
  <p>My question is, how do I convert the <code>True</code> to <code>true</code> after loading the json file? Later in my code I use the <code>jdata.iteritems()</code> to get all the keys and values.</p>
  
  <p>If I write like this</p>
  
  <pre><code>jdata = json.load(open(json_path))
  convert = json.dumps(jdata, {"true": True, "false": False})
  </code></pre>
  
  <p>it will print out:</p>
  
  <pre><code>{"XYZ": true}
  </code></pre>
  
  <p>But then I can't do </p>
  
  <pre><code>for key, value in convert.iteritems():
      #code
  </code></pre>
  
  <p>because I get this error:</p>
  
  <pre><code>AttributeError: 'str' object has no attribute 'iteritems'
  </code></pre>
  
  <p>How can I fix this?</p>
  
  <p><strong>EDIT</strong>
  Here is the code</p>
  
  <pre><code>def ReadAndValidate(directory, json_path):
  
      jdata = json.load(open(json_path))
      path = findAllFiles(directory)
  
      if os.path.isdir(path):
          for root, dirs, files in os.walk(path):
              for key, value in jdata.iteritems():
                  for name in files:
                      with open(os.path.join(root, name)) as fle:
                          content = fle.read()
                      if name.endswith('.txt') and re.search(Wordboundry(key), content):
                          print "Name", key, "was found in", name, "\n"
                          writeToFile(value, content, name, key)
                     else:
                         print "Name", key, "was not found in", name"
  
  
  def writeToFile(value, file_content, file, name):
      if type(value) is list:
          nrOfvalue = ' '.join([str(myValue) for myValue in value])
          nrOfvalue = "[ " + nrOfvalue + " ]"
          content = regFindName(name, nrOfvalue, file_content)
      else:
          content = regFindName(name, value, file_content)
      writeToFile(file, content)
  </code></pre>
  
  <p>I am using argumentparser where directory could be "C\Mydir\Dir1" and json_path "C:\MyDir\Dir1\myjson.json</p>
  
  <p>myjson contains:</p>
  
  <pre><code>{"XYZ": true}
  </code></pre>
  
  <p>Function tries to find "XYZ" in a file. Leys say it finds it in the file "myFile.txt" which contains:</p>
  
  <pre><code>XYZ = false;
  </code></pre>
  
  <p>I wanna replace false with true if the name matches. The expected output in "myFile.txt" should be:</p>
  
  <pre><code>XYZ = true
  </code></pre>
  
  <p>The regFindName() finds the "name" (ex XYZ) by using regex++</p>