{"id":18151998,"url":"https://github.com/timf34/jsondetective","last_synced_at":"2025-08-18T08:08:43.149Z","repository":{"id":259788657,"uuid":"879370680","full_name":"timf34/JSONDetective","owner":"timf34","description":"Instantly understand and summarize JSON structure through automatic schema inference via a Python CLI","archived":false,"fork":false,"pushed_at":"2024-11-03T16:52:55.000Z","size":19,"stargazers_count":23,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-04T11:16:33.943Z","etag":null,"topics":["developer-tools","json","pypi","python","schema"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/jsondetective/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timf34.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-27T18:15:20.000Z","updated_at":"2025-06-26T13:26:37.000Z","dependencies_parsed_at":"2024-10-28T02:08:47.660Z","dependency_job_id":"f3ed31c3-1257-4c07-a1f7-9698d37afe3b","html_url":"https://github.com/timf34/JSONDetective","commit_stats":null,"previous_names":["timf34/jsondetective"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/timf34/JSONDetective","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2FJSONDetective","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2FJSONDetective/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2FJSONDetective/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2FJSONDetective/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timf34","download_url":"https://codeload.github.com/timf34/JSONDetective/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timf34%2FJSONDetective/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270962391,"owners_count":24675965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["developer-tools","json","pypi","python","schema"],"created_at":"2024-11-02T02:05:15.319Z","updated_at":"2025-08-18T08:08:43.113Z","avatar_url":"https://github.com/timf34.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# JSONDetective 🔍\n\nA powerful tool for analyzing and understanding JSON schemas. Built to handle large, complex JSON files by\nautomatically detecting and abstracting patterns in your data.\n\nKey features:\n- Automatically recognizes and normalizes date formats in both keys and values\n- Detects optional fields by analyzing multiple instances\n- Abstracts repeated patterns into clean, readable schemas\n\n## Quick Start\n\n```bash\n# Install\npip install jsondetective\n\n# Use\njsondetective data.json\n```\n\n## Pattern Recognition Example\n\nGiven a JSON with repeated date patterns like:\n```json\n{\n  \"2021-08-24\": {\"views\": 100, \"likes\": 20},\n  \"2021-08-25\": {\"views\": 150, \"likes\": 30},\n  \"2021-08-26\": {\"views\": 200, \"likes\": 40}\n}\n```\n\nJSONDetective recognizes the pattern and abstracts it as:\n```json\n{\n  \"yyyy-mm-dd_1\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"views\": {\"type\": \"integer\"},\n      \"likes\": {\"type\": \"integer\"}\n    }\n  }\n}\n```\nNote: The `_1` suffix indicates the nesting level in the JSON structure.\n\n## Complex Structure Example\n\nIt also handles nested structures with various data types and patterns:\n\n```json\n{\n  \"users\": [\n    {\n      \"id\": \"123\",\n      \"joined_date\": \"2024-01-15\",\n      \"last_active\": \"2024-03-20T15:30:00Z\",\n      \"activity\": {\n        \"2024-03-19\": {\"posts\": 5},\n        \"2024-03-20\": {\"posts\": 3}\n      },\n      \"preferences\": {\n        \"theme\": \"dark\",\n        \"notifications\": true\n      }\n    }\n  ],\n  // many more users...\n}\n```\n\nProduces this clean schema:\n```json\n{\n  \"users\": {\n    \"type\": \"array\",\n    \"items\": {\n      \"id\": {\n        \"type\": \"string\",\n        \"examples\": [\"123\"]\n      },\n      \"joined_date\": {\n        \"type\": \"string\",\n        \"format\": \"yyyy-mm-dd\"\n      },\n      \"last_active\": {\n        \"type\": \"string\",\n        \"format\": \"datetime\"\n      },\n      \"activity\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"yyyy-mm-dd_2\": {\n            \"type\": \"object\",\n            \"properties\": {\n              \"posts\": {\"type\": \"integer\"}\n            }\n          }\n        }\n      },\n      \"preferences\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"theme\": {\n            \"type\": \"string\",\n            \"optional\": true\n          },\n          \"notifications\": {\n            \"type\": \"boolean\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\n## Features\n\n- **Intelligent Pattern Detection**: \n  - Recognizes date formats in both keys and values\n  - Abstracts repeated structures\n  - Identifies optional fields\n- **Schema Intelligence**: \n  - Detects data types\n  - Identifies nested structures\n  - Provides example values\n- **Experimental**: Python dataclass generation (beta feature)\n\n## Advanced Usage\n\n### Experimental Python Dataclass Generation\n\n```bash\n# Print dataclass to console\njsondetective data.json -d\n\n# Save to file\njsondetective data.json -d -o my_dataclasses.py\n\n# Custom class name\njsondetective data.json -d -c MyDataClass\n```\n\n### CLI Options\n\n```bash\njsondetective [JSON_FILE] [OPTIONS]\n\nOptions:\n  -d, --create-dataclass     Generate Python dataclass code\n  -o, --output-path PATH     Save dataclass to file\n  -c, --class-name TEXT      Name for the root dataclass (default: Root)\n  --help                     Show this message and exit\n```\n\n## Why Use JSONDetective?\n\n- **Pattern Recognition**: Automatically detects and abstracts repeated patterns\n- **Date Handling**: Intelligent date format recognition and normalization\n- **Large Files**: Efficiently processes and summarizes large JSON structures\n- **Clear Output**: Clean, readable schema representation\n- **Time Saving**: No manual inspection of large JSON files needed\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimf34%2Fjsondetective","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimf34%2Fjsondetective","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimf34%2Fjsondetective/lists"}