title: sending json object to function python
body: <p>I need to pass a JSON object to a separate function in python</p>
  
  <pre><code>import json
  
  userList = [{username: 'userName', email: 'email'}]
  
  listString = json.dumps(userList)
  print(json.loads(listString))
  </code></pre>
  
  <p>this will print the same object: <code>[{username: 'userName', email: 'email'}]</code></p>
  
  <p>I know it isn't possible to pass a JSON object directly to another function which is why I'm turning it into a string and trying to unpack it in the new function</p>
  
  <pre><code>testFunction(listString)
  
  def testFunction(oldList):
      print(json.dumps(oldList))
  </code></pre>
  
  <p>this will print out <code>[{'username': 'userName', 'email': 'email'}]</code> but won't let me return the object from the new function. What do I need to do to fix this? </p>
  
  <pre><code>def testFunction(oldList):
      newList = json.loads(oldList)
      # code to append to newList
  
      return newList
  
  
  Response: null
  </code></pre>