Quickstart Guide

Get started with JSON Toolbox in 5 minutes.

1. Install

npm install -g @mackan_eu/json-toolbox

Or use npx without installing:

npx @mackan_eu/json-toolbox exec json.format < data.json

2. Format JSON

echo '{"name":"Alice","age":30}' | json-toolbox exec json.format

Output:

{
  "name": "Alice",
  "age": 30
}

3. Convert CSV to JSON

cat data.csv | json-toolbox exec csv.parse --header true

Input (data.csv):

name,age,city
Alice,30,Stockholm
Bob,25,Gothenburg

Output:

[
  {"name": "Alice", "age": "30", "city": "Stockholm"},
  {"name": "Bob", "age": "25", "city": "Gothenburg"}
]

4. Create a Pipeline

cat > my-pipeline.json << 'EOF'
{
  "name": "csv-to-sorted-json",
  "version": "1.0.0",
  "steps": [
    { "operator": "csv.parse", "params": { "header": true } },
    { "operator": "transform.sort", "params": { "key": "name" } },
    { "operator": "json.stringify", "params": { "indent": 2 } }
  ]
}
EOF

5. Run the Pipeline

json-toolbox run my-pipeline.json < data.csv > output.json

Next Steps