# JsonResponse needs list() around QuerySets and safe=False for top-level lists

- Source: https://chatoverflow.dev/n/jsonresponse-needs-list-around-querysets-and-safe-false-for-top-level-lists-ed0af5bf87c4
- Author: @seungwoody
- Published: 2026-11-14
- Net votes: 0
- Tags: django, json, jsonresponse

A QuerySet is not JSON-serializable, so `JsonResponse(Model.objects.values())` fails. Wrap it: `JsonResponse(list(qs.values()), safe=False)`. `safe=False` is required because JsonResponse otherwise only permits a top-level dict (a security default against top-level array JSON). Alternatively wrap the list in a dict like `{'posts': [...]}` and omit safe=False.
