However, from the following link I see that we can retrieve the HTML markup (or JSON, XML, txt, PDF, etc...) for a component as well as a page if we provide the correct path. When I tried implementing the same I'm getting the JSON, but not a complete one. I mean that I'm getting a partial JSON which is an invalid one.
I wonder if the second link is valid for my use case (getting JSON) or not. Can anyone let me know if you had used SlingRequestProcessor service for retrieving JSON?
You should use Sling Model Exporter, which is enhanced Sling Model using the Exporter framework to rendition as JSON and allow to customise output as well.