Hi David,
In general +1 for the generic boiler plate approach.
In terms of a generic JSON solution is could do with some additional type checks to make sure they are output correctly, e.g. booleans as true / false / null, empty numbers being returned as null and not empty string etc.
So just for booleans as an untested example you might replace...
with this..
The alternative, if just going from SQL to a serialised JSON string could be to just use SQL and JSON_ARRAYAGG as per the examples here...
https://community.intersystems.com/post/how-do-i-return-json-database-sql-call
- Log in to post comments