enactjson-formatter
Formats and prettifies JSON with configurable indentation
When & Why to Use This Skill
The JSON Formatter skill is a specialized utility designed to transform minified or unformatted JSON strings into a clean, human-readable structure. By providing configurable indentation and instant syntax validation, it streamlines the process of debugging, documenting, and analyzing data, ensuring that developers and data analysts can work with structured information more efficiently.
Use Cases
- API Debugging: Quickly prettify compact JSON responses from API calls to inspect data structures and troubleshoot integration issues.
- Data Validation: Verify the syntax of JSON strings to identify errors and ensure compatibility with downstream applications.
- Documentation Preparation: Format raw JSON data into a clean, indented style for inclusion in technical documentation, wikis, or code comments.
- Log Analysis: Transform dense, single-line JSON log entries into a readable format to simplify the identification of specific events or anomalies.
| enact | "2.0.0" |
|---|---|
| name | enact/json-formatter |
| version | 1.0.1 |
| description | "Error message if JSON was invalid" |
| from | "node:20-alpine" |
| command | "node /workspace/format.js ${json} ${indent}" |
| timeout | "30s" |
| type | string |
| default | 2 |
| readOnlyHint | true |
| idempotentHint | true |
JSON Formatter
A simple tool that formats and prettifies JSON strings.
Usage
enact run enact/json-formatter --args '{"json": "{\"name\":\"test\",\"value\":123}", "indent": 2}'
Features
- Validates JSON input
- Configurable indentation (default: 2 spaces)
- Returns structured output with validation status
- Handles errors gracefully
Example Output
{
"formatted": "{\n \"name\": \"test\",\n \"value\": 123\n}",
"valid": true
}