Skip to content

feat: JSON export for submissions (export is CSV-only) #16

Description

@hawkeye-sama

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:

  1. 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.

  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions