orangy: What is the most efficient way to do this as of today?
So in a typical project, let's take the one I have currently open in front of me, there's an ORM layer, Hibernate in this case, ORM is used in the service layer to retrieve data from the DB and package it in Kotlin objects, then these ORM objects are copied over to View Objects in the controller layer where it's serialized to JSON.
In the frontend, which is Angular Dart, there's Dart View objects that got generated by something I built called Dartifier (which basically generated Dart Objects to mimc the Kotlin objects and ease serialization / deserialization and keep the View Ojbects in sync between Dart and Kotlin)
So the majority of the project is just abstracting data from one format to another to another to yet another and all the way back, madness! But on the flipside, what's the solution to this?
Back in the Java days, I tried to use the Hibernate objects as the View Objects and in the UI I kept it in "Map" format which maps the JSON 100%, so the only conversion was from Map -> Json -> Hibernate -> Json -> Map
It sounded like a great idea, in practice, it was disastrous, what you have in your DB doesn't map that well to what you need in the UI and vice versa.