name: jinfer description: Use jinfer to infer JSON schema from JSON files. Trigger when user wants to understand JSON structure, generate JSON Schema, or inspect the shape of JSON data.
jinfer — JSON Schema Inference
jinfer is a zero-dependency CLI tool and Python library that instantly infers structured schemas from any JSON file. It is installed on this machine and available as the jinfer command. Requires Python 3.10+. Installed via uv tool install jinfer.
When to use
Use jinfer when the user:
- Asks about the structure or shape of a JSON file
- Wants to generate a JSON Schema from sample data
- Needs to inspect or understand what fields and types exist in JSON data
- Has a JSON file and wants a quick overview of its contents
- Wants to validate or document the structure of JSON output
CLI usage
Basic tree view (pretty-printed schema summary):
jinfer <file.json>
Output as JSON Schema (draft-07):
jinfer <file.json> -f json
Limit traversal depth (useful for large or deeply nested files):
jinfer <file.json> -d 3
Pipe from stdin:
cat file.json | jinfer -
Save output to a file:
jinfer <file.json> -f json -o schema.json
Key flags
| Flag | Short | Description |
|---|---|---|
--format |
-f |
Output format: pretty (default) or json (JSON Schema draft-07) |
--depth |
-d |
Limit schema inference depth to N levels |
--output |
-o |
Write output to a file instead of stdout |
--no-additional-properties |
Set additionalProperties: false on all objects (JSON only) |
|
--refs |
Deduplicate repeated object shapes into $defs/$ref (JSON only) |
|
--version |
-v |
Print the installed version |
Python library usage
from jinfer import infer_schema, format_schema, generate_json_schema
# Infer schema from a Python object
schema = infer_schema(data)
# Pretty-print as a tree
print(format_schema(schema))
# Generate JSON Schema draft-07 dict
json_schema = generate_json_schema(schema)
Tips
- For large JSON files, use
-dto limit depth first, then increase as needed. - Use
-f jsonwhen you need a machine-readable schema for validation or documentation. - The tree format is best for quick human inspection of structure.
- When piping, use
-as the filename to read from stdin.