input: Write a function `create_json_api` that creates a Flask API endpoint to fetch data from an SQL database and returns it as a JSON object. The function should connect to a SQLite database named 'database.db', fetch all records from the 'users' table, and convert them into a JSON format. 
  
  assert create_json_api() == "@app.route('/', methods=['GET'])\ndef index(): \n    connection = sqlite3.connect('database.db')\n    connection.row_factory = dict factory\n    cur = connection..\n    all_users = cur.execute('SELECT * FROM users;')..n......;"
output: 
  @app.route('/', methods=['GET'])
  def index(): 
      connection = sqlite3.connect('database.db')
      connection.row_factory = sqlite3.Row
      cur = connection.cursor()
      all_users = cur.execute('SELECT * FROM users;').fetchall()
      connection.close()
      return jsonify(all_users)
  