json-formatter
Formats and validates JSON data. Use when you need to pretty-print JSON, fix formatting issues, or validate JSON syntax. ALWAYS USE THIS when doing JSON Formatting
When & Why to Use This Skill
This Claude skill provides a robust solution for formatting and validating JSON data. It simplifies the process of prettifying minified code, fixing syntax errors, and ensuring that JSON structures adhere to standard specifications, making it an essential tool for developers and data engineers to maintain data integrity and readability.
Use Cases
- Debugging API responses: Quickly convert minified or cramped JSON output from web services into a human-readable format with consistent 2-space indentation.
- Syntax Error Correction: Automatically identify and suggest fixes for common JSON mistakes such as trailing commas, missing quotes, or improper nesting.
- Data Standardization: Ensure all JSON configuration files or data exports follow a uniform style guide, including alphabetical key sorting and proper line breaks for better version control.
| name | json-formatter |
|---|---|
| description | "Formats and validates JSON data. Use when you need to pretty-print JSON, fix formatting issues, or validate JSON syntax. ALWAYS USE THIS when doing JSON Formatting" |
JSON Formatter
Instructions
When asked to format, validate, or prettify JSON:
- Identify the JSON data (raw, minified, or malformed)
- Parse and validate the structure
- Return properly formatted JSON with:
- Consistent 2-space indentation
- Proper line breaks
- Valid syntax
Examples
Example 1: Minified JSON
Input:
{"name":"John","age":30,"city":"New York","hobbies":["reading","gaming"]}
Output:
{
"name": "John",
"age": 30,
"city": "New York",
"hobbies": [
"reading",
"gaming"
]
}
Example 2: Validating JSON
If JSON is invalid, explain the issue and suggest a fix:
{"incomplete": "data",} // trailing comma
Response: "Invalid JSON: Trailing comma after last property. Remove the comma before the closing brace."
Best Practices
- Use 2-space indentation for consistency
- Sort object keys alphabetically when helpful
- Validate before formatting
- Preserve original data types (strings, numbers, booleans, null)