input: Write a function named `fetch_data_from_sql` that connects to an SQL database, fetches all data from the 'users' table, and returns the data as a JSON object. The function should utilize a dictionary factory to format each row into a dictionary before converting the entire result to JSON. If the database or the 'users' table is empty, the function should return an empty JSON object.
  
  assert fetch_data_from_sql()==[]
  assert fetch_data_from_sql()==[{"id": 1, "name": "John Doe"}, {"id": 2, "name": "Jane Doe"}]
  assert fetch_data_from_sql()==[{"id": 3, "name": "Alice"}, {"id": 4, "name": "Bob"}]
  assert fetch_data_from_sql()==[]
  assert fetch_data_from_sql()==[{"id": 5, "name": "Charlie"}, {"id": 6, "name": "Dana"}]
output: def fetch_data_from_sql():
      import sqlite3
      import json
      
      try:
          conn = sqlite3.connect('example.db')
          conn.row_factory = sqlite3.Row
          cursor = conn.cursor()
          cursor.execute("SELECT * FROM users")
          rows = cursor.fetchall()
          data = [dict(row) for row in rows]
          return json.dumps(data)
      except sqlite3.Error:
          return json.dumps([])
      finally:
          if conn:
              conn.close()