I wonder, if the below idea makes sense for our web application. We show various lists of entities, which typically refer to other entities and so on. In the table view, there are columns showing some properties of the entity itself (like e.name) and also of the linked entities (like e.owner.email).The classical way is to create DTOs containing all these columns and sent them. This means that for any column added, there need to be a (trivial) change on the server. There's also a bunch of redundancies, as many linked entities are the same. For example, e.owner is nearly always the same, as (with some exceptions) everyone can see their own entities only.So my idea was to send JSONized entities, where the references get replaced by their IDs and additionally send a list of the referenced entities. This all recursively, so for the object graph[    {        id: 101,        name: something1,        company: {            id: 201,            name: someCompany            owner: {                id: 301,                firstName: Bart,                lastName: Simpson                email: bart.simpson@example.com,            }        }    },    {        id: 102,        name: something1,        company: {            id: 201,            name: someCompany            owner: {                id: 301,                firstName: Bart,                lastName: Simpson                email: bart.simpson@example.com,            }        }    },]instead of[    {        id: 101,        name: something1,        company_name: someCompany,        company_owner_firstName: Bart,        company_owner_lastName: Simpson,        company_owner_email: bart.simpson@example.com,    },    {        id: 102,        name: something2,        company_name: someCompany,        company_owner_firstName: Bart,        company_owner_lastName: Simpson,        company_owner_email: bart.simpson@example.com,    },]I'd send{    entities: [        {            id: 101,            name: something1,            company: 201,        },        {            id: 102,            name: something2,            company: 201,        }    ],    companies: [        {            id: 201,            name: someCompany            owner: 301,        }    ],    owners: [        {            id: 301,            firstName: Bart,            lastName: Simpson            email: bart.simpson@example.com,        }    ],}and let the client re-combine the things when displaying the result. This could lead to nice bandwidth savings (not visible in this tiny example), but this is probably what Content-Encoding: gzip achieves anyway.The next step could be some caching on the client, so that only changed and/or new entities would be sent. This could save much more. The implementation overhead is surely non-trivial, but I'm sure it can be done in a day or two.My questions:Is there already anyone doing this?Is it a good idea?
Transfer flattened entities instead of DTOs?
web applications;json;client server