Reputation: 2731
I'm a newbie building APIs with django/python
I built a dictionary object (it has lists inside other lists in it), and I want to send it to the front through one of the responses: JsonResponse, HttpResponse, etc.
What could be the way to do it?
I tried with several of them without a good response, I whether get an error, or a bad response
Thanks in advance
Rafael
Upvotes: 0
Views: 44
Reputation: 2731
I got it
Just assume that you will send an array of objects, and the front end should access the first object it finds
myResponse = []
myResponse.append(myObject)
return HttpResponse(myResponse, status=200) // status is optional
Upvotes: 0