Skip to content

[Under Progress ] npm package to convert JSON and CSV data into a Markdown table. Supports both API responses and local JSON files.

Notifications You must be signed in to change notification settings

krishana7911/json-to-table-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON to Table CLI

A simple and lightweight CLI tool to convert JSON data (from files or API responses) into a human-readable Markdown table format. Perfect for documentation or quick data viewing.

🚀 Features

  • 📁 Convert a local JSON file to a Markdown table.
  • 🌐 Fetch JSON data directly from an API and convert it to a table.
  • 📝 Output the table to a .md file for easy documentation integration.
  • ❌ Error handling for invalid JSON input or missing parameters.

📦 Installation

You can either install the CLI globally or run it with npx without installation.

Using npx (No Installation Required)

Run the following command to execute the tool:

npx json-to-table-cli --url <api-url> --output <output-file.md>

Install Globally

To install the tool globally:

npm install -g json-to-table-cli

📝 Usage

1. Convert JSON from an API to Markdown Table

json-to-table-cli --url https://jsonplaceholder.typicode.com/users --output users-table.md

2. Convert a Local JSON File to Markdown Table

json-to-table-cli --file ./data/users.json --output users-table.md

3. Display Help

json-to-table-cli --help

📊 Example Output

Given the following JSON:

[
  { "id": 1, "name": "John Doe", "email": "john@example.com" },
  { "id": 2, "name": "Jane Smith", "email": "jane@example.com" }
]

The generated users-table.md will look like this:

| ID  | Name        | Email             |
| --- | ----------- | ----------------- |
| 1   | John Doe    | john@example.com  |
| 2   | Jane Smith  | jane@example.com  |

🛠️ Error Handling

If something goes wrong, you'll get a clear error message. Common issues include:

  • Invalid JSON format.
  • Missing --url or --file parameter.
  • File path or API endpoint not accessible.

🤝 Contributing

Contributions are welcome! If you'd like to add new features or improve the code, feel free to fork the repo and submit a pull request.

📜 License

This project is licensed under the MIT License.

About

[Under Progress ] npm package to convert JSON and CSV data into a Markdown table. Supports both API responses and local JSON files.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published