3 ms·
You say "out of the box" but it's not that simple... 'blah blah DateTime is not JSON serializable'
by whalesalad 12y ago
You say "out of the box" but it's not that simple... 'blah blah DateTime is not JSON serializable'
- andybak 12y agoJust tried it: from django.core import serializers print serializers.serialize("json", StockCount.objects.all()[:2]) >> [{"fields": {"timestamp": "1900-01-02T00:00:00Z", "version": 0, "item_instance": null, "item_model": 408, "stock_level": 999, "location": 2}, "model": "stocklevels.stockcount", "pk": 1}, {"fields": {"timestamp": "1900-01-02T00:00:00Z", "version": 0, "item_instance": null, "item_model": 409, "stock_level": 999, "location": 2}, "model": "stocklevels.stockcount", "pk": 2}]