At the moment my code is something as follows. But I am unable to return a json object. In an ideal scenario I want my custom response to be as shown below in the post.