title: Why is python responding to an Android client different depending on the use of a dictionary?
body: <p>I have been writing an application for Android that receives a response from a cgi-script (python) that access data from a MySQL DB in order to generate dynamic content. I receive the response fine. I am trying to use a python dictionary server-side so that I can respond to the android client with a JSON array. During debugging, if I don't use a dictionary, like this:</p>
  
  <pre><code>with con: 
      cur = con.cursor()
      cur.execute("SELECT * from posts")
      rows = cur.fetchall()
  
  print "Content-type: text/html"
  print
  if cur:
      print row[1] #this entry in the DB is a datetime field, however other fields suffer from the same problem
  else:
      print "Something went wrong."
  </code></pre>
  
  <p>In that case, I get the response on the android client in a desirable format, such as 2013-06-06 23:03:47. </p>
  
  <p>On the other hand, if I create a dictionary and place the value under a key such as my column name like this:</p>
  
  <pre><code>with con: 
      cur = con.cursor()
      cur.execute("SELECT * from posts")
      rows = cur.fetchall()
  
  print "Content-type: text/html"
  print
  if cur:
      for row in rows:
          d = {'time':row[1]}
          print d
  else:
      print "Something went wrong."
  </code></pre>
  
  <p>Then the response I receive has formatting issues. I receive a response like:</p>
  
  <pre><code>{'time':datetime.datetime(2013,6,6.23.3.47)}
  </code></pre>
  
  <p>The same happens with numbers that I've used Decimal on. Instead of showing as just the number, as they do in a normal print, inside the dictionary (response) they show as:</p>
  
  <pre><code>Decimal('12.345678')
  </code></pre>
  
  <p>Could anyone with more knowledge than me shed some light on the subject?</p>
  
  <p>Thanks in advance!</p>