JSON ↔ CSV Conversion API

🔄 Code Examples


🔄 Getting Started

  1. All examples assume:
  2. Endpoint: POST /api/convert/csv-to-json
  3. Header: X-API-KEY
  4. JSON payload format

🔄 Code Examples

curl -X POST https://yourdomain.com/api/convert/json-to-csv \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "json": [
      { "name": "Alice", "age": 30 },
      { "name": "Bob", "age": 25 }
    ]
  }'
const response = await fetch(
  "https://yourdomain.com/api/convert/json-to-csv",
  {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-API-KEY": process.env.API_KEY
    },
    body: JSON.stringify({
      json: [
        { name: "Alice", age: 30 },
        { name: "Bob", age: 25 }
      ]
    })
  }
);

const result = await response.json();
console.log(result.csv);
import requests

url = "https://yourdomain.com/api/convert/json-to-csv"
headers = {
    "X-API-KEY": "YOUR_API_KEY",
    "Content-Type": "application/json"
}

payload = {
    "json": [
        {"name": "Alice", "age": 30},
        {"name": "Bob", "age": 25}
    ]
}

response = requests.post(url, json=payload, headers=headers)
print(response.json()["csv"])
using System.Net.Http.Json;

var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-API-KEY", "YOUR_API_KEY");

var response = await client.PostAsJsonAsync(
    "https://yourdomain.com/api/convert/json-to-csv",
    new
    {
        json = new[]
        {
            new { name = "Alice", age = 30 },
            new { name = "Bob", age = 25 }
        }
    });

var result = await response.Content.ReadFromJsonAsync();
Console.WriteLine(result.csv);

            $headers = @{
              "X - API - KEY" = "YOUR_API_KEY"
                                "Content-Type" = "application/json"
                        }

                        $body = @{
                      json = @(
                                        @{ name = "Alice"; age = 30 },
                                        @{ name = "Bob"; age = 25 }
                                )
                        } | ConvertTo - Json

                        $response = Invoke - RestMethod `
                                -Uri "https://yourdomain.com/api/convert/json-to-csv" `
              -Method Post `
                                -Headers $headers `
                                -Body $body

                        $response.csv
                
📌 Request Payload

                {
                  "json": [
                    { "name": "Alice", "age": 30 },
                    { "name": "Bob", "age": 25 }
                  ]
                }
            
📤 Response Example

                {
                  "csv": "name,age\nAlice,30\nBob,25"
                }
            
Tip: Your API key is shown only once. Store it securely or regenerate it from your dashboard.