json-formatter
Skill1 starsChanged 3 months agoMITView on GitHub
Use when a user has messy or minified JSON that needs formatting, wants to validate a JSON file, extract specific fields from nested JSON, or convert a JSON array of objects to CSV.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- JinwangMok/openclaw-simple-skillstheir own version, first seen Mar 28, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- JinwangMok/openclaw-simple-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository58 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- api-test-suiteSkill
- ascii-artSkill
- caddy-reverse-proxySkill
- changelog-generatorSkill
- color-palette-generatorSkill
- cron-taskSkill
- csv-toolkitSkill
- discord-bot-buildSkill
- docker-umbrellaSkill
- dotfiles-manageSkill
- email-sendSkill
- env-config-managerSkill
- excalidraw-diagramSkill
- file-organizerSkill
- forgejo-self-hostSkill
- frontend-design-toolkitSkill
- generate-dockerfileSkill
- gif-searchSkill
- git-backupSkill
- github-actions-ciSkill
- hallmark-readmeSkill
- http-api-testerSkill
- invoice-generatorSkill
- log-analyzerSkill
- markdown-linterSkill
- markdown-to-pdfSkill
- markdown-to-slidesSkill
- mcp-server-buildSkill
- media-id-mappingSkill
- movie-catalogue-siteSkill
- movie-night-calendarSkill
- ntfy-notifierSkill
- ocr-documentsSkill
- ollama-localSkill
- openapi-generatorSkill
- password-generatorSkill
- pdf-extractSkill
- portfolio-upkeepSkill
- qr-code-generatorSkill
- regex-testerSkill
- resume-builderSkill
- rss-monitorSkill
- searxng-self-hostSkill
- skill-publishSkill
- skill-registry-catalogSkill
- skills-portfolio-scaffoldSkill
- snippet-managerSkill
- sqlite-dashboardSkill
- streaming-provider-embedsSkill
- tailscale-deploySkill
- telegram-bot-buildSkill
- tmdb-metadataSkill
- uptime-kuma-self-hostSkill
- watchlist-syncSkill
- webhook-receiverSkill
- youtube-transcriptSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 155
Read the JSON (string or file)
- Very specific: line 156
If validation fails, try fix_json to fix common errors
- Distinctive: line 158
If extracting fields, use dot-notation paths
- Distinctive: line 159
If converting to CSV, flatten the array
- Very specific: line 168
Unicode: Use ensure_ascii=False to keep Unicode characters readable.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
json-formatter
Overview
Format, validate, minify, and transform JSON. The agent handles malformed JSON, pretty-prints messy output, extracts specific fields with dot-notation paths, and converts between JSON and other formats.
When to Use
- The user has messy or minified JSON that needs formatting.
- The user wants to validate a JSON file.
- The user wants to extract specific fields from a large JSON.
- The user says "format this JSON", "pretty print this", or "validate my JSON".
Pretty Print
import json
def pretty_print(json_str: str, indent: int = 2) -> str:
"""Format JSON with indentation."""
data = json.loads(json_str)
return json.dumps(data, indent=indent, ensure_ascii=False)
def pretty_print_file(input_path: str, output_path: str = None, indent: int = 2):
"""Format a JSON file in place or to a new file."""
with open(input_path, 'r') as f:
data = json.load(f)
out = output_path or input_path
with open(out, 'w') as f:
json.dump(data, f, indent=indent, ensure_ascii=False)
return outMinify
def minify_json(json_str: str) -> str:
"""Remove all whitespace from JSON."""
data = json.loads(json_str)
return json.dumps(data, separators=(',', ':'), ensure_ascii=False)Validate
def validate_json(json_str: str) -> dict:
"""Validate JSON and return error details if invalid."""
try:
json.loads(json_str)
return {"valid": True}
except json.JSONDecodeError as e:
return {
"valid": False,
"error": str(e),
"line": e.lineno,
"column": e.colno,
"position": e.pos,
"context": json_str[max(0, e.pos-20):e.pos+20] if e.pos else ""
}Extract Fields
def extract_fields(data, paths: list):
"""Extract specific fields from nested JSON using dot notation.
paths = ["user.name", "user.email", "items.0.title"]
"""
def get_nested(obj, path):
keys = path.split('.')
current = obj
for key in keys:
if isinstance(current, list):
try:
current = current[int(key)]
except (ValueError, IndexError):
return None
elif isinstance(current, dict):
current = current.get(key)
else:
return None
if current is None:
return None
return current
if isinstance(data, str):
data = json.loads(data)
return {path: get_nested(data, path) for path in paths}JSON to CSV
import csv
def json_to_csv(json_path: str, csv_path: str, record_path: str = None):
"""Convert a JSON array of objects to CSV."""
with open(json_path, 'r') as f:
data = json.load(f)
if record_path:
# Navigate to the array
for key in record_path.split('.'):
data = data[key]
if not isinstance(data, list):
raise ValueError("JSON must be an array of objects")
# Collect all field names
fieldnames = set()
for record in data:
fieldnames.update(record.keys())
fieldnames = sorted(fieldnames)
with open(csv_path, 'w', newline='') as f:
writer = csv.DictWriter(f, fieldnames=fieldnames)
writer.writeheader()
for record in data:
writer.writerow({k: record.get(k, '') for k in fieldnames})
return csv_pathFix Common JSON Errors
def fix_json(json_str: str) -> str:
"""Attempt to fix common JSON formatting errors."""
# Remove trailing commas
json_str = re.sub(r',\s*([}\]])', r'\1', json_str)
# Replace single quotes with double quotes
json_str = json_str.replace("'", '"')
# Remove comments (// and /* */)
json_str = re.sub(r'//.*?$', '', json_str, flags=re.MULTILINE)
json_str = re.sub(r'/\*.*?\*/', '', json_str, flags=re.DOTALL)
return json_str
import reWorkflow
- Read the JSON (string or file)
- If validation fails, try
fix_jsonto fix common errors - Pretty-print with 2-space indent
- If extracting fields, use dot-notation paths
- If converting to CSV, flatten the array
- Return the formatted/validated/extracted result
Common Pitfalls
- Trailing commas. Standard JSON doesn't allow trailing commas.
fix_jsonremoves them, but validate first to know if there's an issue. - Single quotes. JSON requires double quotes. JSON5 allows single quotes, but standard parsers reject them.
- Comments in JSON. Standard JSON doesn't allow comments. JSONC and JSON5 do.
fix_jsonstrips comments for standard compatibility. - Large JSON files.
json.load()loads the entire file into memory. For files over 100MB, useijsonfor streaming parsing. - Unicode. Use
ensure_ascii=Falseto keep Unicode characters readable. Withensure_ascii=True(default), they become\uXXXXescapes. - Nested arrays.
json_to_csvonly flattens one level. Deeply nested objects need manual flattening before CSV conversion.
Verification Checklist
validate_jsonreports valid before any downstream transform (extract/CSV/minify) is trusted- Output uses
ensure_ascii=Falsewhen Unicode readability matters fix_jsonoutput is re-validated withjson.loadsbefore being treated as fixed- CSV conversion confirms the source resolves to a flat array of objects (not nested) before running
- Files over 100MB use a streaming parser (
ijson), notjson.load
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

