python - Using json.dumps(string) to dump a string -
i want put string json.dumps()
string = "{data}" print json.dumps(string) and get:
"{data}" instead of: {data}
how can string without quotes?
method replace:
json.dumps(string.replace('"', '') or strip:
json.dumps(string.strip('"') does not work.
you don't dump a string to a string.
d = {"foo": "bar"} j = json.dumps(d) print(j) output:
{"foo": "bar"} it makes no sense use string argument of json.dumps expecting dictionary or list/tuple argument.
serialize
objjson formatted str using conversion table.
Comments
Post a Comment