Moved json.dumps to mysql_query function