I think two ways you could accomplish the reduction in overhead are by either:
A. You can actually try this, it may give you exactly what you are looking for:
system.util.jsonEncode(system.dataset.toPyDataSet(system.db.runNamedQuery(project, path, params)))
Converting it into a pyDataset, and then into Json, however the compute overhead would still be done on the client, it just may be faster.
B. Moving the formatting onto your database and adjusting your query to format the data into a JSON structure at runtime, so that when you are querying data it returns a JSON string that you then use a system.util.jsonDecode() and parse it into the object that you need to use? Something like this should help you accomplish that https://www.sqlshack.com/convert-sql-server-results-json/