JSON to CSV API
Convert JSON arrays to CSV format via REST API. Takes a JSON array of objects and produces properly escaped RFC 4180 CSV with headers derived from the object keys. Optional parameters for custom delimiter, quote character, and Excel BOM compatibility.
Try it live →How it works
POST a JSON array of objects. The API extracts all unique keys as column headers, then serializes each object into a CSV row. Nested objects are flattened with dot notation by default. Empty fields produce empty CSV cells.
Use cases
- Export API response data as CSV for spreadsheet analysis
- Generate CSV reports from database query results
- Convert structured JSON logs to CSV for Excel-based analysis
- Produce CSV downloads in a web app from JSON API data
API Reference
POST https://slopshop.gg/v1/text-json-to-csv
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Input parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text / input |
string | required | The text or data to process |
Example response
{
"data": {
"result": "[{\"key\":\"value\"}]",
"rows": 1
},
"meta": {
"credits_used": 3,
"engine": "real",
"ms": 4
}
}
Examples
Three real-world scenarios showing how developers use JSON to CSV in production.
curl -X POST https://slopshop.gg/v1/text-json-to-csv \
-H "Authorization: Bearer $SLOPSHOP_KEY" \
-H "Content-Type: application/json" \
-d '{"data": [{"name": "Alice", "email": "alice@example.com", "plan": "pro"}, {"name": "Bob", "email": "bob@example.com", "plan": "free"}]}'
curl -X POST https://slopshop.gg/v1/text-json-to-csv \
-H "Authorization: Bearer $SLOPSHOP_KEY" \
-H "Content-Type: application/json" \
-d '{"data": [{"month": "Jan", "revenue": 42000, "costs": 31000}, {"month": "Feb", "revenue": 51000, "costs": 34000}]}'
curl -X POST https://slopshop.gg/v1/text-json-to-csv \
-H "Authorization: Bearer $SLOPSHOP_KEY" \
-H "Content-Type: application/json" \
-d '{"data": [{"api": "llm-summarize", "calls": 142, "credits": 1420}, {"api": "crypto-hash-sha256", "calls": 891, "credits": 891}]}'
Code examples
curl
curl -X POST https://slopshop.gg/v1/text-json-to-csv \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input": "your data here"}'
Python
import requests
response = requests.post(
"https://slopshop.gg/v1/text-json-to-csv",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"input": "your data here"}
)
result = response.json()
print(result["data"])
Node.js
const response = await fetch("https://slopshop.gg/v1/text-json-to-csv", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ input: "your data here" })
});
const { data } = await response.json();
console.log(data);
CLI
# Install the Slopshop CLI
npm install -g slopshop
# Set your API key
export SLOPSHOP_KEY=your_api_key
# Call text-json-to-csv
slop text-json-to-csv '{"input": "your data here"}'
Pricing
Credits are purchased in bundles starting at $1 for 1,000 credits. All compute APIs like this one use 3 credits per call — that's $0.003. See all pricing tiers.
Related APIs in Data Transform
View the full API catalog · Try in playground · Documentation