This is a very simple script that queries a SQLite database and then takes the results and returns them in JSON format.
Please note in order for this script to work properly, you will need to install simplejson
I have attached a sample SQLite DB for you to play with. Just make sure the database is in the same folder as script itself.
Let me know if you have any questions or suggestions for improvement.