Guide · CSV

How to prepare a CSV for REST API import

A reliable CSV import starts before the request is sent. Use this checklist to catch structural and data-quality problems while they are still easy to fix.

CSV and JSON represent data differently

CSV is a tabular format. It has columns and rows, and values are commonly interpreted as text when imported.

A REST API request typically uses structured JSON. Properties have specific names, values may have different types and some fields may be optional or required.

CSV

Company Name,Revenue,Active
Apple,"₹3,83,000",Yes

API JSON

{
  "company_name": "Apple",
  "revenue": 383000,
  "active": true
}

CSV preparation checklist

01

Confirm the API fields

Know which properties the endpoint accepts and the expected type of each property before changing the CSV.

02

Preserve source headers

You do not always need to rename spreadsheet headers. A mapping layer can connect human-friendly source names to API property names.

03

Inspect numeric formatting

Look for currency symbols, commas, spaces, percentages and other presentation formatting before converting values to numbers.

04

Normalize known boolean labels

Determine whether values such as Yes, No, Active, Inactive, Enabled or Disabled should become true or false.

05

Review empty cells

Decide whether missing values should be omitted, sent as null, defaulted or rejected.

06

Check unexpected variants

Scan for outliers such as N/A, unknown currencies, unusual casing or values that appear only once.

07

Validate every row

Do not assume a transformation is safe because it worked on the first example.

08

Generate a sample payload first

Inspect the resulting JSON before using it with the target API.

You do not need identical column names

Renaming every source column to match an API is not always desirable. The original CSV may be used by other people or systems. Instead, preserve the source structure and define an explicit mapping:

Company Name → company_name
Country → country_code
Annual Revenue → revenue
Is Active → active

Watch for mixed formats in the same column

Real datasets often contain several representations of the same concept:

₹3,83,000
$85,000
52000
N/A

A rule that removes the rupee symbol and commas will not fix the dollar symbol or N/A. This is why dataset-wide validation is more useful than checking only a sample value.

Validate before you send

The safest point to find a malformed record is before it reaches the API. Validate mappings, types and transformed values first.

This is especially important for bulk imports. One unusual value buried hundreds of rows into a file can otherwise cause partial failures or require additional cleanup after the import has started.

Keep a clean source and an explicit transformation

Where possible, avoid destructively editing the original source file merely to satisfy one API. An explicit mapping and transformation pipeline documents how the source data becomes the API representation and makes the process easier to review or reuse.

Prepare and validate your CSV in PayloadForge

Import a CSV, map its columns, transform incompatible values and inspect validation results before generating JSON or cURL.