Skip to content

feat: export as csv and json in mock-data generator #34

@zhravan

Description

@zhravan

Description

It would be great to have a feature that allows users to export generated mock data to .json or .csv files directly from the Mock Data Generator tab.

Current Behavior

  • Users can copy the output to clipboard as JSON or CSV
  • But there's no direct option to download it as a file

Expected Behavior

Add buttons to:

  • Export mock data as .json file
  • Export mock data as .csv file

These buttons can live alongside the existing Generate, Copy JSON, and Copy CSV buttons.

// Use Blob and URL.createObjectURL() to trigger downloads

function downloadFile(content, filename, type) {
  const blob = new Blob([content], { type });
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = filename;
  a.click();
  URL.revokeObjectURL(url);
}

Optional features:

  • Allow customizing filename before download
  • Support exporting only selected rows

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions