# Csv To Json

> Convert between CSV and JSON formats — CSV to JSON array, CSV to JSONL, JSON to CSV, JSONL to CSV. Handles type inference, header/record mapping, nested structure flattening, and encoding issues. Use when the user wants to reformat tabular data between row-oriented CSV and object-oriented JSON forms.

- **Type:** Skill
- **Install:** `agentstack add skill-danielrosehill-claude-data-wrangler-plugin-csv-to-json`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [danielrosehill](https://agentstack.voostack.com/s/danielrosehill)
- **Installs:** 0
- **Category:** [Data & Analytics](https://agentstack.voostack.com/c/data-and-analytics)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [danielrosehill](https://github.com/danielrosehill)
- **Source:** https://github.com/danielrosehill/Claude-Data-Wrangler-plugin/tree/master/skills/csv-to-json

## Install

```sh
agentstack add skill-danielrosehill-claude-data-wrangler-plugin-csv-to-json
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# CSV ↔ JSON Conversions

Bidirectional conversion between CSV and JSON/JSONL.

## Supported directions

- **CSV → JSON array** — single file containing a JSON array of objects.
- **CSV → JSONL** — one JSON object per line (streaming-friendly).
- **JSON → CSV** — flatten JSON array of objects to CSV.
- **JSONL → CSV** — streaming line-by-line conversion.

## Procedure

1. **Confirm source and target** — file paths and directions.
2. **Detect CSV dialect** (if CSV is the source):
   - Delimiter (`,`, `;`, `\t`, `|`) — use `csv.Sniffer` or ask user if ambiguous.
   - Quote character (`"`, `'`).
   - Header present? Assume yes; confirm if the first row looks like data.
   - Encoding — try `utf-8`, fall back to `utf-8-sig` (BOM), then `cp1252` / `latin-1`. Report the encoding used.
3. **Type inference for CSV → JSON**:
   - Default: preserve as strings (safest).
   - Optional: infer types (int, float, bool, null) — ask the user. Use pandas' inference or explicit conversion.
   - Handle nulls: empty string, `NA`, `null`, `NaN` → JSON `null` (confirm the sentinel list with user).
4. **Nested structures for JSON → CSV**:
   - If JSON has nested objects/arrays, offer:
     - **Flatten** with dotted keys (e.g. `address.city`, `tags[0]`).
     - **JSON-encode** nested fields as strings in the CSV.
     - **Error** — refuse and point to `json-restructure` for explicit flattening.
   - Default: flatten with dotted keys; confirm with user.
5. **Write the output** with a sensible default name (`.json`, `.jsonl`, `.csv`).
6. **Validate the round-trip** — load the output and report row/object count matching the source.

## Dependencies

```bash
pip install pandas
```

Standard library `csv` and `json` are sufficient for many cases; pandas is convenient for type inference and large files.

## Edge cases

- **Very large files** — use streaming (JSONL line-by-line, CSV chunked via `pd.read_csv(chunksize=...)`). Warn if input > 1 GB and recommend JSONL over JSON array.
- **Mixed types per column** — pandas may coerce; report columns that ended up as `object` when numeric was expected.
- **Fields containing newlines** — CSV must quote them; JSON handles natively. Verify round-trip preserves content.
- **Date / datetime** — JSON has no native datetime type. Emit ISO 8601 strings; record the format in the data dictionary.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [danielrosehill](https://github.com/danielrosehill)
- **Source:** [danielrosehill/Claude-Data-Wrangler-plugin](https://github.com/danielrosehill/Claude-Data-Wrangler-plugin)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-danielrosehill-claude-data-wrangler-plugin-csv-to-json
- Seller: https://agentstack.voostack.com/s/danielrosehill
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
