title: TypeError: string indices must be integers while parsing JSON using Python?
body: <p>I am confuse now why I am not able to parse this JSON string. Similar code works fine on other JSON string but not on this one - I am trying to parse JSON String and extract script from the JSON.</p>
  
  <p>Below is my code.</p>
  
  <pre><code>for step in steps:
      step_path = '/example/v1' +'/'+step
  
      data, stat = zk.get(step_path)
      jsonStr = data.decode("utf-8")
      print(jsonStr)
      j = json.loads(json.dumps(jsonStr))
      print(j)
      shell_script = j['script']
      print(shell_script)
  </code></pre>
  
  <p>So the first <code>print(jsonStr)</code> will print out something like this - </p>
  
  <pre><code>{"script":"#!/bin/bash\necho Hello world1\n"}
  </code></pre>
  
  <p>And the second <code>print(j)</code> will print out something like this - </p>
  
  <pre><code>{"script":"#!/bin/bash\necho Hello world1\n"}
  </code></pre>
  
  <p>And then the third print doesn't gets printed out and it gives this error - </p>
  
  <pre><code>Traceback (most recent call last):
    File "test5.py", line 33, in &lt;module&gt;
      shell_script = j['script']
  TypeError: string indices must be integers
  </code></pre>
  
  <p>So I am wondering what wrong I am doing here?</p>
  
  <p>I have used same above code to parse the JSON and it works fine..</p>