Logic to convert SQLite Data to JSON complete