input: Write a function to create an API in Python that fetches data from an SQL database and presents the data in the form of a JSON. The function should use Flask for the API and sqlite3 for the database connection. It should return a JSON response containing all the data from the 'users' table in the database. If the 'users' table is empty, it should return an empty JSON array.
  assert create_api() == { "1": {"id": 1, "name": "Alice"}, "2": {"id": 2, "name": "Bob"} }
  assert create_api() == {}
output: 
  def create_api():
      from flask import Flask, jsonify
      import sqlite3
  
      app = Flask(__name__)
  
      @app.route('/users', methods=['GET'])
      def get_users():
          conn = sqlite3.connect('database.db')
          cursor = conn.cursor()
          cursor.execute("SELECT * FROM users")
          rows = cursor.fetchall()
          conn.close()
  
          users = {}
          for row in rows:
              users[str(row[0])] = {"id": row[0], "name": row[1]}
  
          return jsonify(users)
  
      return get_users()
  