I need to create a json array like ["a", "b", "c", "d"]
I'm trying to create it as follows
import json
with open('djs.json', 'w') as outfile:
for dj in DJ.objects.all():
json.dump(str(dj), outfile, separators=(',', ': '))
This creates something like "a","b","c","d"
What would be the correct way to do this?
DJ.objects.all()?DJ.objectsare objects of my Django model.djis a Django model object that contains all the information regarding a DJ.djevaluates to the DJ name if that's what you are asking.