How to build custom json api controller for category wise post in wordpress?

Here is the custom json api controller code for category wise post in wordpress: