I've sent some form-data from my React client to my Django + DRF api.
inside of the form-data I have an attribute date_strings
which is an array of date-time strings. i.e. ["date1", "date2", "date3"]
in order to send it to my Django api I converted the array of strings into a string using JSON.stringify
const myForm = new FormData();
myForm.set("date_strings", JSON.stringify(dateStrings));
in the create method of my serializer, I'd like to convert this data into a list.
def create(self, validated_data):
stringified_array = validated_data.pop('date_strings')
// stringified_array: '["date1", "date2", "date3"]'
how can I convert an array of strings inside of a string into a python list?