I am having issues with writing json objects to a file using csv writer, the json objects seem to have multiple double quotes around them thus causing the json objects to become invalid, here is the result:
"{""user.CustomAttribute.ISOLanguageCode"": ""en"", ""user.Email"": ""[email protected]""
what I want is
{"user.CustomAttribute.ISOLanguageCode": "en", "user.Email"": "[email protected]"}
here is how I open the file, perhaps there is an argument I can pass to prevent this from happening?
file = csv.writer(open(localResultPath + ".txt",'ab'),delimiter = '|')
here is how I write to the file, the last append adds the json as a string
list.append(pk)
list.append(email)
list.append(json)
file.writerow(list)