Python: remove double quotes from JSON dumps Python: remove double quotes from JSON dumps json json

Python: remove double quotes from JSON dumps


You are dumping list of strings so json.dumps does exactly what you are asking for. Rather ugly solution for your problem could be something like below.

def split_and_convert(s):    bits = s[1:-1].split(',')    return (        int(bits[0]), bits[1], float(bits[2]),        float(bits[3]), float(bits[4]), float(bits[5])    )data_to_dump = [split_and_convert(s) for s in data]json.dumps(data_to_dump)