how to develop a wordpress plugin to fetch the posts from the parameters given at home page and parse it as json, like JSON API Plugin : I am trying to develop a small wordpress plugin to fetch the posts, pages from the website and parse it as json to further use in mobile apps. 
Right now i am achiving the goal via this method:

1) Created a file webservice.php on my current active theme eg. twentythirteen. So the location of the file is http://www.example.com/wp-content/themes/twentythirteen/webservice.php

2) I am posting the parameters on that url to get a json response like this
http://www.example.com/wp-content/themes/twentythirteen/webservice.php?type=page&limit=10

The thing is i want to post parameters on the home page like this

http://www.example.com?type=page&limit=10 

i dont know how to do it i have seen 'JSON API' Plugin which is doing the same thing but not able to find on its code how its fething the request from home page and parse JSON on the same page. Can any one help me with this

