How to get all projects related to a JQL?

Hello

I would like to get all statuses needed for issues that might be returned by some JQL.
There is an api that allows to get statuses from project:
rest/api/3/project/${projectId}/statuses

Great. So now how to get projects keys or ids from a JQL.

First issue to think about is JQL can also use project names and the api requires key or id.
There is jql sanitize api that allows to change names to id, however:

  1. it is experimental
  2. it reuires ADMIN app scope to work :frowning:

But lets assume, I did it, still JQLs can be quite complex.
There is parse jql query api that could be used, but again:

  1. it is experimental
  2. the output still would need to be parsed

Is there any good possibility to get ids/keys of projects related to specific JQL or writing own simple parser is required?