GET /api/v1/forms/{id}/export currently returns CSV, and only CSV. If your form data has nested values or you want to pipe an export into a script, JSON is the more natural format.
Scope:
-
API: support ?format=json on the same endpoint, CSV stays the default so nothing breaks.
GET /api/v1/forms/{id}/export?format=json
should return the submissions array (id, createdAt, data) with Content-Type: application/json and a matching Content-Disposition filename. The handler in apps/web/src/app/api/v1/forms/[id]/export/route.ts already fetches and shapes everything, so this is mostly a branch on the query param before the CSV serialization.
-
Dashboard: the current "Export CSV" button lives in apps/web/src/components/dashboard/submissions-section.tsx. Turn it into an export control with both options (a small dropdown with "Export as CSV" / "Export as JSON" is fine) that hits the endpoint with the right format.
Both parts belong in one PR so the feature ships whole.
GET /api/v1/forms/{id}/exportcurrently returns CSV, and only CSV. If your form data has nested values or you want to pipe an export into a script, JSON is the more natural format.Scope:
API: support
?format=jsonon the same endpoint, CSV stays the default so nothing breaks.should return the submissions array (id, createdAt, data) with
Content-Type: application/jsonand a matchingContent-Dispositionfilename. The handler inapps/web/src/app/api/v1/forms/[id]/export/route.tsalready fetches and shapes everything, so this is mostly a branch on the query param before the CSV serialization.Dashboard: the current "Export CSV" button lives in
apps/web/src/components/dashboard/submissions-section.tsx. Turn it into an export control with both options (a small dropdown with "Export as CSV" / "Export as JSON" is fine) that hits the endpoint with the rightformat.Both parts belong in one PR so the feature ships whole.