About json-formatter
A skill for formatting, validating, and prettifying JSON. It parses supplied JSON and returns valid, consistently indented output, or explains syntax errors and suggests corrections.
Key features
- 01Parse and validate JSON
- 02Format with two-space indentation
- 03Handle minified JSON
- 04Explain syntax errors
- 05Preserve JSON data types
Use cases
- 01Prettifying minified JSON
- 02Checking JSON before use
- 03Diagnosing malformed JSON
- 04Standardizing indentation in JSON
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ thomasholknielsen/ claude-code-config --skill json-formatterAfter installing, type/json-formatterin Claude Code to confirm it loaded.
Details
From the project READMEJSON 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)
Comments
Markdown supported