This page was machine-translated. Spotted a mistake?Help improve it.
Skip to content

CSV to JSON

Converte tra i formati CSV e JSON in entrambe le direzioni. Carica un file CSV o TSV per ottenere un array JSON di oggetti, oppure carica un array JSON per ottenere un file CSV.

API Endpoint

POST /api/v1/tools/files/csv-json

Accetta dati form multipart con un file CSV, TSV o JSON e un campo JSON settings.

Parameters

ParameterTypeRequiredDefaultDescription
prettybooleanNotrueFormatta l'output JSON con indentazione

Example Request

CSV to JSON:

bash
curl -X POST http://localhost:1349/api/v1/tools/files/csv-json \
  -H "Authorization: Bearer si_your-api-key" \
  -F "[email protected]" \
  -F 'settings={"pretty": true}'

JSON to CSV:

bash
curl -X POST http://localhost:1349/api/v1/tools/files/csv-json \
  -H "Authorization: Bearer si_your-api-key" \
  -F "[email protected]" \
  -F 'settings={}'

Example Response

json
{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/users.json",
  "originalSize": 1500,
  "processedSize": 2200
}

Notes

  • La direzione della conversione viene rilevata automaticamente dall'estensione del file di input: .csv o .tsv produce .json, e .json produce .csv.
  • Il parametro pretty influisce solo sull'output JSON. Quando impostato su false, l'output è una stringa JSON compatta su una sola riga.
  • L'input JSON deve essere un array di oggetti con chiavi coerenti. Ogni oggetto diventa una riga e ogni chiave diventa un'intestazione di colonna.
  • I file TSV (valori separati da tabulazioni) sono supportati insieme a CSV.