MySQL to JSON: Nightly Table Export to FTP Template
A nightly Schedule trigger queries a MySQL table, converts the rows to a JSON file, and uploads it to an FTP server for downstream systems to pick up.
What It Builds
This Spojit template runs on a Schedule trigger every night. A Connector node on the mysql connector reads the rows you want to export, a Connector node on the json connector turns those rows into a clean JSON document, and a final Connector node on the ftp connector uploads the file to a directory on your FTP server. The result is a dated export file waiting for whatever downstream system reads from that server: a data warehouse loader, a partner integration, or an archival job.
The Prompt
Paste this into Miraxa, the intelligent layer across your automation, and it builds the workflow, connecting the tools for you:
Build a workflow that runs every night at 1am Australia/Sydney time. It should query my MySQL "orders" table for rows created in the last 24 hours, convert the result rows into a JSON file named "orders-export-{{ date }}.json", and upload that file to the "/exports" directory on my FTP server.
Connectors Used
- Schedule trigger - fires the workflow nightly on a 5-field cron expression with an IANA timezone (for example
0 1 * * *inAustralia/Sydney). - mysql - reads your table with
execute-queryso you control exactly which rows and columns are exported. - json - shapes and serializes the rows with tools such as
pick,stringify, andprettifyinto a single file. - ftp - writes the file to a remote directory with
upload-file(and optionally creates the folder first withcreate-directory).
Customize It
Change the table name, the date window, and the cron expression to match your data and your downstream system's pickup schedule. Swap the destination path in the prompt to point at the directory your partner reads from, and adjust the file name pattern if downstream tooling expects a specific naming convention. If you only need certain columns, name them in the prompt so the json step keeps the payload lean. To export several tables in one run, ask Miraxa to add more mysql query steps before the upload.
Tips
- Use Direct mode on every Connector node here. Each step is a single predictable call (one query, one conversion, one upload), so Direct mode keeps the run deterministic and spends no AI credits.
- Make the export date-windowed (rows from the last 24 hours) rather than a full table dump so each nightly file stays small and re-runs do not duplicate data downstream.
- Include a timestamp in the file name (for example
orders-export-2026-06-23.json) so a failed or repeated run never overwrites a good file already collected by the downstream system.
Common Pitfalls
- A Schedule trigger uses the timezone you set, not the viewer's local time. Confirm the IANA timezone (such as
Australia/Sydney) so "nightly" fires when you expect after daylight-saving changes. - If the target FTP directory does not exist yet,
upload-filecan fail. Add acreate-directorystep first, or have Miraxa create the path before the upload. - Wide tables or large date windows can produce big files. Narrow the query to the columns and rows you actually need so the export stays inside your downstream system's size expectations.
Related Articles
- How to Export Orders to CSV via FTP - the step-by-step tutorial if you want a CSV file instead of JSON.
- How to Transform CSV Data to JSON for API Uploads - more on shaping tabular data into JSON.
- How to Sync Shopify Data to MySQL for Reporting - a companion pipeline that feeds the MySQL table you export here.
- Setting Up a Schedule Trigger - how cron expressions and timezones work for nightly runs.