I'm quite new to Django Rest Framework. I couldn't find on the docs something that would allow me to serialize my models according to the JSON API standards (jsonapi.org).
Let's suppose I have the following models.
class Person(models.Model):
    name = models.CharField(max_length=200)
class Car(models.Model):
    owner = models.ForeignKey(Person)
    brand =  
    model = models.CharField(max_length=200)
    plate = models.CharField(max_length=200)
I would like to serialize it in a way that it would provide me with the following output:
{
    "data":[
        {
            "type": "Person",
            "id": 1,
            "attributes": {
                "name": "John",
            },
            "relationships": {
                "cars": [
                    {
                        "data": {
                            "type": "Car",
                            "id": 1,
                            "attributes": {
                                "brand": "Bugatti",
                                "model": "Veyron",
                                "plate": "PAD-305",
                            },
                        },
                    },
                    {
                        "data": {
                            "type": "Car",
                            "id": 2,
                            "attributes": {
                                "brand": "Bugatti",
                                "model": "Chiron",
                                "plate": "MAD-054",
                            },
                        },
                    },
                ],
            },
        },
        {
            "type": "Person",
            "id": 2,
            "attributes": {
                "name": "Charllot",
            },
            "relationships": {
                "cars": [
                    {
                        "data": {
                            "type": "Car",
                            "id": 3,
                            "attributes": {
                                "brand": "Volkswagen",
                                "model": "Passat CC",
                                "plate": "OIJ-210",
                            },
                        },
                    },
                    {
                        "data": {
                            "type": "Car",
                            "id": 4,
                            "attributes": {
                                "brand": "Audi",
                                "model": "A6",
                                "plate": "NAD-004",
                            },
                        },
                    },
                ],
            },
        }
    ],
    "meta":{
        "backend_runtime": "300ms", // processed at the view
    }
}
 
     
     
    