Use REST. Check out the documentation.
You can do in your SQL query with FOR JSON statement:
SELECT * FROM yourtable FOR JSON AUTO. Then follow this example and return it to the client.
SELECT * FROM yourtable FOR JSON AUTO
Please, sign in to be able to submit a new answer.