input: Write a function to develop an API in Python that fetches data from an SQL database and presents the data in the form of a JSON. The function should take no input and return a Flask application that reads data from a specified SQL database table and returns it as a JSON response when accessed via an HTTP GET request.
  assert app.test_client().get('/').get_json() == [{"id": 1, "name": "Alice"}, {"id": 2, "name": "Bob"}]
output: def create_app():
      from flask import Flask, jsonify
      import sqlite3
  
      app = Flask(__name__)
  
      @app.route('/')
      def get_data():
          conn = sqlite3.connect('example.db')
          cursor = conn.cursor()
          cursor.execute("SELECT id, name FROM users")
          data = cursor.fetchall()
          conn.close()
          result = [{"id": row[0], "name": row[1]} for row in data]
          return jsonify(result)
  
      return app