Comments

A few more details about your exact use case would help me give a better answer here. As for the exact questions you asked, here's an example of the syntax you can use to write a query as part of a class:

Now, if your real question is something along the lines of "I want to write a REST endpoint that gives me back the result of a class query in Person as JSON", then unfortunately that's a non-trivial problem. The fastest way would be to write some endpoint, like /basicpersoninfo, and have the REST handler route requests for that endpoint to a method that uses JSON_ARRAYAGG and JSON_OBJECT and dynamic SQL (discussed in that other thread) to write out the results of that query in JSON.