title: 'module' object has no attribute 'loads' while parsing JSON using python
body: <p>I am trying to parse JSON from Python. I recently started working with Python so I followed some stackoverflow tutorial how to parse JSON using Python and I came up with below code - </p>
  
  <pre><code>#!/usr/bin/python
  import json
  
  j = json.loads('{"script":"#!/bin/bash echo Hello World"}')
  print j['script']
  </code></pre>
  
  <p>But whenever I run the above code, I always get this error - </p>
  
  <pre><code>Traceback (most recent call last):
    File "json.py", line 2, in &lt;module&gt;
      import json
    File "/cygdrive/c/ZookPython/json.py", line 4, in &lt;module&gt;
      j = json.loads('{"script":"#!/bin/bash echo Hello World"}')
  AttributeError: 'module' object has no attribute 'loads'
  </code></pre>
  
  <p>Any thoughts what wrong I am doing here? I am running cygwin in windows and from there only I am running my python program. I am using Python 2.7.3</p>
  
  <p>And is there any better and efficient way of parsing the JSON as well?</p>
  
  <p><strong>Update:-</strong></p>
  
  <p>Below code doesn't work if I remove the single quote since I am getting JSON string from some other method - </p>
  
  <pre><code>#!/usr/bin/python
  
  import json
  
  jsonStr = {"script":"#!/bin/bash echo Hello World"}
  
  j = json.loads(jsonStr)
  shell_script = j['script']
  print shell_script
  </code></pre>
  
  <p>So before deserializing how to make sure, it has single quote as well?</p>
  
  <p>This is the error I get -</p>
  
  <pre><code>Traceback (most recent call last):
    File "jsontest.py", line 7, in &lt;module&gt;
      j = json.loads(jsonStr)
    File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
      return _default_decoder.decode(s)
    File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  TypeError: expected string or buffer
  </code></pre>