SQL to Firebase Converter
Transform SQL database dumps into Firebase Realtime Database format
SQL Input
Firebase JSON Output
About SQL to Firebase Converter
Convert SQL database dumps (CREATE TABLE and INSERT statements) to Firebase Realtime Database JSON structure. Perfect for migrating SQL data to Firebase or creating test data for Firebase applications.
Key Features
- Automatic Parsing: Extracts table structure and data from SQL dumps
- Type Conversion: Converts SQL data types to appropriate JSON types (numbers, booleans, strings, null)
- Flexible Keys: Choose between auto-generated keys or use a specific column as the key
- Firebase Compatible: Generates JSON structure ready for Firebase import
- Key Sanitization: Removes Firebase-restricted characters (., #, $, [, ]) from keys
- File Upload: Upload .sql files directly
How to Use
- Input SQL Data: Paste your SQL CREATE TABLE and INSERT statements or upload a .sql file
- Configure Keys: Choose auto-generated keys or specify a column to use as Firebase keys
- Review Output: The Firebase JSON generates automatically
- Copy or Download: Use the Copy or Download button to save your Firebase data
Key Options
- Auto-Generated Keys: Creates keys like item_0, item_1, item_2... (default)
- Custom Key Field: Use a specific column (e.g., "id") as the Firebase key
Example Conversion
SQL Input:
CREATE TABLE employees ( id INT PRIMARY KEY, name VARCHAR(100), age INT, salary DECIMAL(10,2) ); INSERT INTO employees VALUES (1, 'John Doe', 28, 75000.00); INSERT INTO employees VALUES (2, 'Jane Smith', 34, 82000.50);
Firebase JSON Output (Auto Keys):
{
"item_0": {
"id": 1,
"name": "John Doe",
"age": 28,
"salary": 75000
},
"item_1": {
"id": 2,
"name": "Jane Smith",
"age": 34,
"salary": 82000.5
}
} Firebase JSON Output (Using 'id' as key):
{
"1": {
"id": 1,
"name": "John Doe",
"age": 28,
"salary": 75000
},
"2": {
"id": 2,
"name": "Jane Smith",
"age": 34,
"salary": 82000.5
}
} Type Conversion
- Numbers: INT, BIGINT, DECIMAL, FLOAT, DOUBLE → JSON numbers
- Booleans: BOOLEAN, true/false → JSON booleans
- Strings: VARCHAR, CHAR, TEXT → JSON strings
- NULL: NULL or empty values → JSON null
Firebase Key Restrictions
Firebase keys cannot contain certain characters. This tool automatically sanitizes keys by replacing the following characters with underscores:
- . (period)
- # (hash)
- $ (dollar sign)
- [ (left bracket)
- ] (right bracket)
Common Use Cases
- Database Migration: Migrate SQL data to Firebase Realtime Database
- Test Data: Create Firebase test data from SQL dumps
- Prototyping: Quickly populate Firebase with existing SQL data
- Data Backup: Export SQL data in Firebase-compatible format
- Cross-Platform: Share data between SQL and Firebase applications
- Development: Seed Firebase development databases from SQL
Importing to Firebase
To import the generated JSON to Firebase Realtime Database:
- Open Firebase Console
- Navigate to Realtime Database
- Click the three-dot menu (⋮) and select "Import JSON"
- Upload the downloaded JSON file
Privacy & Security
All conversions happen locally in your browser. Your SQL data is never uploaded to any server, ensuring complete privacy and security.
