You are trying to convert str value (looking like a JSON) into JSON string.
json.dumps
is to convert Python variables like a dictionary, into JSON string.
dct = {}
dct["a"] = "Ahahaha"
dct["b"] = 3.14
import json
print json.dumps(dct)
So for your case:
- first create valid data structure (like dictionary) with the data you are going to send out
- then use
json.dumps
to convert it to real JSON string and send it out.