input: Write a python function to retrieve student details from a database and return them in JSON format.
  assert get_students() == json.dumps([{'name': 'John Doe', 'age': 20, 'course': 'Math'}, {'name': 'Jane Smith', 'age': 22, 'course': 'Physics'}])
  assert get_students() == json.dumps([])
output: import json
  import sqlite3
  
  def get_students():
      # Connect to the database (replace 'database.db' with your actual database file)
      conn = sqlite3.connect('database.db')
      cursor = conn.cursor()
      
      # Retrieve student details from the database
      cursor.execute("SELECT name, age, course FROM students")
      students = cursor.fetchall()
      
      # Convert the student details to a list of dictionaries
      student_list = [{'name': student[0], 'age': student[1], 'course': student[2]} for student in students]
      
      # Close the database connection
      conn.close()
      
      # Return the student details in JSON format
      return json.dumps(student_list)