
Firestore is known for being a solid cloud-based database that’s widely used for storing and synchronizing data for applications. Its popularity is no coincidence – it has consistently proven to be a flexible and reliable choice for data storage. For this reason, or whether it’s for analysis, backup, or usage in other systems, developers and businesses often need to export data from Firestore to JSON.
However, there is a challenge – Firestore does not offer an immediate option within the Google Console to export data as a JSON file. Fortunately, there are alternative methods to perform this task.
In this guide, we will outline 3 straightforward methods for exporting Firestore data to a JSON file. By the end of this guide, you will gain a clear understanding and learn the necessary steps to export Firestore data to a JSON file.
What Is Firestore?
Firestore, or Cloud Firestore as it’s officially known, is Google’s NoSQL database that is specifically designed to store and synchronize data. This synchronization is maintained for both client and server-side development. This proves to be highly beneficial, especially for mobile and web applications.
Firestore is extensively adopted across various domains, including mobile applications, web services, and server-side systems. Common use cases comprise real-time chat applications, content management systems, user profiles, and online marketplaces.
Some of the key features of Firestore include:
- Security: Data security is a priority in Firestore. It allows for setting up rules to control access to the data and ensures that sensitive information is properly protected.
- Scalability: It can handle increasing amounts of data and traffic. This is crucial for growing applications as it takes the burden of scaling the database off the developer.
- Structured data: Firestore uses documents for storing data. These documents are grouped into collections. Each document is a set of key-value pairs and can also contain subcollections.
- Offline capabilities: It can store data locally on the device when there is no internet connection. Once the connection is restored, it automatically syncs the local data with the cloud.
- Real-time synchronization: One of the standout features of Firestore is its ability to sync data across different devices in real time. If data changes on one device, the update is immediately available on all other devices.
Understanding Firestore Data Model
There are 3 fundamental elements in the Firestore data model.
- Documents: The fundamental units for storing data in Firestore are documents. Each document is a set of key-value pairs.
- Collections: Documents are organized into collections which serve as a way to categorize data.
- Subcollections: Within a document, you can have additional collections known as subcollections. This allows for a hierarchical data structure. For example, in a “Users” collection, a user document might have a subcollection called "orders" representing that user’s orders.
A very important aspect of Firestore is that it is schemaless, meaning that there's no predefined structure that documents must adhere to. Documents within the same collection can have different fields and data types.
What Is The JSON Format?
JSON, which stands for JavaScript Object Notation, provides a simple way to represent data structures and is widely used in web applications for data exchange. It was originally conceived to streamline the communication between JavaScript clients and servers. However, developers quickly realized JSON's flexibility and started to use it for other purposes.
JSON’s immense popularity can be attributed to its lightweight nature and human-readable format. It is also flexible because almost every programming language supports it. Due to its widespread compatibility, JSON has become the de facto standard for exchanging data.
In this section, we will explore the basic JSON structure and discuss important details that will enhance your understanding of this widely used data format.
- Key-value pairs: JSON organizes data into key-value pairs. The key is the name of the item and the value is the data related to that name. So if you have a person named John who is 30 years old, in JSON, it would look like: {"name": "John", "age": 30}.
- Hierarchy: Like Firestore, JSON can also have a hierarchy. Values can be more than just numbers or words; they can also be groups of values (which we call arrays) or even other pairs of keys and values (which we refer to as objects).
- Arrays: Arrays are lists of values that are wrapped in square brackets in JSON. For instance, a list of numbers would look like this: [1, 2, 3].
- Syntax essentials: JSON follows specific rules for its written format, including:
- Keys must be strings (text) and they have to be in double quotes.
- Values can be different data types like numbers, strings, booleans, arrays, or other JSON objects.
- Key-value pairs are separated by commas.
- The whole JSON data is usually wrapped in curly brackets {}.
3 Proven Methods To Export Data From Firestore To JSON
Exporting data from Firestore to a JSON file is required for several reasons – creating backups, facilitating data migration, or enabling data sharing and local analysis. JSON is the ideal choice for these purposes because it is widely compatible and easy to read.
However, Firestore poses a problem in this regard. As it turns out, Firestore does not natively support exporting data in JSON format. Instead, Firestore’s managed export creates backup/export files in Cloud Storage for restore, migration, or BigQuery loading workflows, but it does not provide a simple Firebase Console option to download your data as a readable JSON file. You can read more about the Firestore export/import functionalities here.
While binary format serves certain use cases, it lacks the flexibility and accessibility that JSON offers. But there are options available to get the job done.
Native Firestore managed exports are still useful for backup, restore, project migration, and loading Firestore exports into BigQuery. They are not designed as a simple JSON download from the Firebase Console. Also note that Firestore exports incur one read operation per document exported, so recurring exports can create unexpected costs on large databases.
If your goal is disaster recovery rather than JSON analysis, consider Firestore scheduled backups instead. Firestore backups can run daily or weekly and restore data to a new database. They are better suited for recovery workflows, while JSON exports are better suited for local analysis, portability, or custom downstream processing.
Let's look at three different methods to export Firestore data to JSON.
| Method | Best for | Automation | Main limitation |
|---|---|---|---|
| Estuary + BigQuery export | Ongoing syncs, analytics, backups, and larger Firestore datasets | Automated Firestore capture plus BigQuery export | Requires setting up Estuary, BigQuery, and Cloud Storage |
| Firebase Admin SDK + Python | Small collections, one-time exports, custom scripts | Scriptable, but you own scheduling and error handling | Can be slow or expensive for large datasets and does not automatically handle all subcollections |
| Firefoo | Manual JSON exports from a desktop UI | Manual | Requires a desktop tool and is not ideal for automated backups |
Prerequisites
Follow the steps given below before trying to export Firestore data. The first 2 steps are only needed if you are setting up a new database. If your database is already up and running, jump directly to step 3.
Step 1: Setting Up A Firebase Project
First, you need a Firebase project. This is the foundation where all your data is stored.
- Go to the Firebase console.
- Click on ‘Add project’.
- Fill in the project name and follow the on-screen instructions.
With this, you now have a Firebase project.
Step 2: Enabling Firestore In The Firebase Console
Now let’s enable Firestore.
- In your Firebase project, select ‘Cloud Firestore’ in the left-hand menu.
- Click on ‘Create database’.
- Choose either ‘Start in production mode’ or ‘Start in test mode’, depending on your needs.
- Select a Cloud Firestore location (this is important for latency and availability).
Step 3: Setting Up A Service Account & Permissions
To access and export data from Firestore, set up a service account and generate a key for it. Additionally, this account should have the required permissions.
- In the Google Cloud console, head to the Create service account page.
- Select your Google Cloud project.
- Input a name for the service account.
- Optionally, enter a description.
- Click ‘Create and continue’ for access controls or ‘Done’ if you prefer setting them later.
- Optionally, grant one or more IAM roles to the service account.
- Click ‘Continue’.
- Optionally, add members who can impersonate or manage the service account.
- Click ‘Done’ to finalize creating the service account.
Now let’s generate a new private key for your service account.
- On the Service Accounts page, select your project.
- To generate a key for a specific service account, select its email address.
- Navigate to the Keys tab.
- Select ‘Create new key’ from the ‘Add key’ drop-down menu.
- Choose JSON as the Key type and click ‘Create’.
This action downloads a service account key file. IMPORTANT: Keep it safe as you can’t download it again.
Method 1: Sync Firestore to BigQuery with Estuary, Then Export as JSON
Estuary is our advanced DataOps platform for handling real-time data operations through managed CDC (Change Data Capture) and ETL (Extract, Transform, Load) pipelines. Estuary offers powerful features, such as performing complex real-time transformations and aggregations, allowing for rapid data transfer with end-to-end latency in the millisecond range.
Estuary offers several benefits, including:
- Scalability: It can manage large-scale active workloads, even at rates of 7GB/s, catering to databases of any size.
- Extensibility: Estuary supports integration with various connectors through an open protocol and includes built-in testing.
- Automation: There is no need for scheduling or orchestration tools. Estuary offers automated schema management and data deduplication.
- User-friendly interface: Estuary stands out for its user-friendly interface, providing an intuitive experience that simplifies data processing and transfer tasks, even for users with limited technical expertise.
- Cost effective: By using CDC, Estuary minimizes the data read from the data source and the data written to the destination, which makes it an economical solution.
- Real-Time data transfer: Estuary ensures that your data is transferred immediately as changes occur in Firestore. This real-time data processing ensures that the data remains current.
Now, let's turn our attention to the task at hand: importing data from Firestore into Google BigQuery. Once the data is in BigQuery, you can export the data in JSON format. With Estuary’s powerful, automated CDC and real-time capabilities, this process is both streamlined and cost-effective.
Step 1: Log In To Estuary
Navigate to the Estuary dashboard and sign in. If you don't have an account, sign up for one for free.
Step 2: Create an Estuary Capture From Firestore
- Click on the ‘Captures’ tab and select ‘New capture’.
- Look for ‘Google Firestore’ and select it as the connector.
- Type a unique name for your capture.
- Under Endpoint Config, Input your Google Cloud Service Account JSON credentials into the ‘Credentials’ field.
- (Optional) You can specify the database name in the 'Database' field or leave it blank for autodetection.
- Click ‘Next’. Estuary will connect to Firestore and identify available data resources. You’ll be prompted to choose the collections you want to capture.
- Review the configurations and when you're happy with them, click on ‘Save and publish’. A notification will pop up once the capture is published.
Important Note: Estuary captures Firestore documents into collections and preserves the document structure for downstream materialization. In this workflow, BigQuery is used as the destination so you can export the resulting tables as JSON from Google Cloud.
Consolidating the data from BigQuery into a single, larger file is another approach. This combines all the data into a single, larger file instead of dealing with multiple smaller files. If you prefer this method, let's proceed to the next step.
Step 3: Create an Estuary Materialization To BigQuery
- There are a few prerequisites you need to satisfy before you can use Estuary to connect to BigQuery. Before moving forward, please make sure these requirements are met.
- Next, go to the ‘Materializations’ tab and click on ‘New Materialization’.
- Now select ‘Google BigQuery’ as the connector.
- Choose a unique name for your materialization, similar to what you did for the capture.
- Fill in the required configuration settings under Endpoint Config.
- The Source Collections section now shows each collection you captured earlier. Here you can make changes to the collections before materializing them.
- Click ‘Next’.
- Once satisfied with the configuration, click on ‘Save and publish’.
After you complete these first three steps, Estuary will start moving your Firestore data to BigQuery in real time. You can analyze the data in BigQuery or download it as a JSON file by following the next step.
Step 4: Download Data From BigQuery In JSON format
Once you have transferred your data to Google BigQuery, you can download it for local analysis or backup. Here are the steps to download data from BigQuery into JSON format:
Export Table To Google Cloud storage
BigQuery only allows exporting data to Google Cloud storage. We will first move our JSON file there.
- Go to the BigQuery Console.
- Find the table you want to export and click on it.
- Click on “Export”, then choose “Export to Cloud Storage”.
- Choose JSON as the export format.
- Provide the Google Cloud Storage location.
- Click on “Export”.
Note: BigQuery exports table data as newline-delimited JSON, where each line is a separate JSON object. If you need one JSON array, you may need to post-process the exported file after downloading it.
Download The Exported Data To Your Local System
Now you can download the JSON data exported to Google Cloud Storage to your local system.
- Open the Google Cloud Console.
- Find the bucket where you exported the BigQuery table.
- Navigate to the file you want to download.
- Click on the filename and then click on the “Download” button.
Method 2: Manually Exporting Firestore Data Using the Firebase Admin SDK and Python
You can also export Firestore data to JSON with a custom Python script using the Firebase Admin SDK. This method is useful when you need a one-time export from a specific collection, want full control over the output format, or prefer a lightweight script instead of a third-party tool.
This approach works best for small or moderate exports. For large Firestore databases, recurring exports, or production backup workflows, use an automated pipeline or Firestore’s managed export/backup options instead.
Step 1: Prerequisites
Before you begin, make sure you have:
- Python 3 installed on your system.
- A Firebase project with Cloud Firestore enabled.
- A Google Cloud service account with permission to read the Firestore data you want to export.
- A service account JSON key downloaded to your local machine.
Keep the service account key secure. Do not commit it to GitHub or expose it in client-side code.
Step 2: Install the Firebase Admin SDK
Install the Firebase Admin SDK for Python:
bashpip install firebase-adminStep 3: Authenticate and initialize Firestore
Create a Python file, for example export_firestore_to_json.py, and initialize the Firebase Admin SDK with your service account key.
pythonimport firebase_admin
from firebase_admin import credentials, firestore
# Replace this with the path to your service account JSON key.
key_file = "/path/to/your/service-account-file.json"
cred = credentials.Certificate(key_file)
firebase_admin.initialize_app(cred)
firestore_client = firestore.client()
Step 4: Export a top-level Firestore collection to JSON
The example below exports documents from one top-level collection. Replace laptops with the name of the collection you want to export.
pythonimport json
import firebase_admin
from firebase_admin import credentials, firestore
key_file = "/path/to/your/service-account-file.json"
cred = credentials.Certificate(key_file)
firebase_admin.initialize_app(cred)
firestore_client = firestore.client()
collection_name = "laptops"
documents = firestore_client.collection(collection_name).stream()
data = {}
for doc in documents:
data[doc.id] = doc.to_dict()
json_file = "firestore_data.json"
with open(json_file, "w", encoding="utf-8") as file:
json.dump(data, file, indent=4, default=str)
print(f"Data has been exported to {json_file}")
The default=str argument helps convert Firestore values such as timestamps into strings so the JSON export does not fail on non-standard JSON types.
Step 5: Run the script
Run the script from your terminal:
bashpython export_firestore_to_json.py
After it finishes, you should see a file named firestore_data.json in your working directory.
Important limitation: subcollections are not exported automatically
The script above exports documents from one top-level collection only. It does not automatically export nested subcollections.
For example, if you export a users collection and each user document has an orders subcollection, this simple script will export the user documents but not the nested orders documents.
If your Firestore database uses subcollections, you need to either:
- Write a recursive export function that walks through each document’s subcollections.
- Export each required subcollection separately.
- Use an automated pipeline or managed export workflow if you need complete database coverage.
When to use this method
Use the Firebase Admin SDK method when:
- You only need to export one or a few collections.
- You want a simple JSON file for local analysis or migration.
- Your dataset is small enough to export from a local script.
- You are comfortable managing credentials and script execution yourself.
Avoid this method when:
- You need regular automated exports.
- Your database is large.
- You need all nested subcollections exported automatically.
- You need real-time or incremental syncing.
- You need a production backup and restore workflow.
Method 3: Manually Exporting Firestore Data Using A Third-Party Tool
Let’s explore the last approach for exporting Firestore data to a JSON file using a third-party tool, Firefoo. It is a desktop tool that is available on Mac, Windows, and Linux. Not only does it allow you to manage multiple Firebase projects, but it also lets you efficiently browse, query, and edit your Firestore data.
Firefoo is best for manual exports, inspection, and admin workflows. It is not a replacement for an automated Firestore export or backup pipeline.
Before we jump into the steps of exporting Firestore data using Firefoo, let’s discuss some of its limitations.
- One of the significant drawbacks of using Firefoo is that you need to export data manually. It doesn’t offer an automated way to handle regular backups or exports.
- Secondly, you need to purchase a license to continue using it beyond the trial period.
Now that we’re clear on what to expect, let’s get down to business. Here’s a step-by-step guide to exporting Firestore data using Firefoo:
Step 1: Download & Install Firefoo
- Go to the Firefoo website and download the tool.
- Follow the installation instructions to set it up on your system.
Step 2: Connect Firefoo To Firebase
- Open Firefoo. If you’ve used Firebase CLI tools before, Firefoo might automatically connect to your project.
- If not, you'll see the "Add Firebase Project" popup.
- You have 3 options: Sign in with Google, Import Service Account Key JSON, or Add Local Emulator.
Step 3: Select Your Firebase Project
- Once you’re signed in, close the browser tab and head back to Firefoo.
- You should now see a list of Firebase projects in the sidebar. Select the one you want to export data from.
Step 4: Export Firestore Data To JSON
- Right-click on an existing Firestore collection you want to export.
- Select "Export Collection".
- A dialog box will pop up. Make sure "JSON Format" is selected.
- Click the Export icon to begin the export operation.
- Choose where you want to save the file and you're good to go.
Step 5: Check The Progress
- A progress popup will appear. You can close it; the export will continue in the background.
- To see the progress again, go to File > Tasks.
Conclusion
Exporting data from Firestore to JSON is a vital skill for cloud database administrators, developers, and data engineers seeking efficiency, scalability, and data portability. This process empowers you to break free from vendor lock-in and ensures that your data remains accessible and usable even if you decide to switch to a different database system in the future.
Exporting Firestore data to JSON gives you the freedom to integrate your data with various platforms, perform in-depth analysis, and build custom data pipelines tailored to your specific needs.
Estuary is the strongest fit when you need ongoing Firestore syncs into an analytics system rather than a one-time manual JSON export. By capturing Firestore changes and materializing them into destinations like BigQuery, Estuary gives teams a more automated path for analysis, backup workflows, and downstream processing.
So, if you're looking for a streamlined solution to facilitate the effortless export of Firestore data, Estuary can help you automate this workflow. Sign up now and get started for free or reach out to our team for more information on how our platform can be tailored to your specific requirements.

About the author
Jeffrey is a data engineering professional with over 15 years of experience, helping early-stage data companies scale by combining technical expertise with growth-focused strategies. His writing shares practical insights on data systems and efficient scaling.










