How to use json-rpc in django?

Hello
Decided to get acquainted with django, I only know very superficial things.
In search of the perfect, decided to develop APIs using json-rpc. Library django-modern-rpc.
Documentation checked a couple of examples, everything is fine.
But as soon as I decided to make a selection from DB and return it, then got error
{
 "id": 1,
 "jsonrpc": "2.0",
 "error": {
 "code": -32603,
 "message": "Internal error: Unable to serialize result as valid JSON: Object of type QuerySet is not JSON serializable"
}
}


The question how to return samples, objects, etc.?
('ve seen examples where people use numpy, but I'm not sure the best solution)
April 19th 20 at 12:26
1 answer
April 19th 20 at 12:28
for your task it is more convenient to use Django Rest Framework. there, in particular, there is such a thing as the serializers (that of Jankowski models and QuerySet's make a simple Python data structure; this step, apparently, you have failed), and the standard things implemented out of the box.
you can also install these from DRF serializers in your RPC method, or to combine REST and JSON-RPC. - destinee.Boy commented on April 19th 20 at 12:31

Find more questions by tags RPCJSONDjango