'Gradle task list that can be parsed

I am looking for a way to retrieve the output of gradle tasks in a way that can be (easily) parsed. Ideally in JSON for instance.

I feel that I am missing the obvious. I was expecting to be able to do something like gradle tasks --json, or at least to find an equivalent somehow. But I searched and found nothing.

Any idea?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source