Name | py-json-analyzer JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | A powerful CLI and Python library for analyzing, visualizing, exploring, and generating code from JSON data |
upload_time | 2025-08-20 10:20:45 |
maintainer | None |
docs_url | None |
author | MS-32154 |
requires_python | >=3.7 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[](https://pypi.org/project/py-json-analyzer/)
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
# JSON Explorer
**JSON Explorer** is a powerful CLI and Python library for analyzing, visualizing, exploring, and generating code from JSON data.
---
## Features
### Analysis & Exploration
- View JSON as a tree (compact, raw, or analytical)
- Search by key, value, key-value pairs, or custom filter expressions
- Generate statistical summaries and insights
- Create visualizations in terminal, browser, or matplotlib
- Interactive terminal exploration mode
### Code Generation
- Generate strongly-typed data structures from JSON
- Multiple language support (Go, with Python, TypeScript, Rust coming soon)
- Smart type detection and conflict resolution
- Configurable naming conventions and templates
- JSON serialization tags and annotations
- Interactive configuration and preview
### Library Features
- Usable as a Python library with modular components
- Extensible architecture for custom generators
- Template-based code generation
- Configuration profiles and validation
---
## Requirements
- Python >= 3.9
Required packages:
```
numpy==2.3.2
requests==2.32.5
rich==14.1.0
setuptools==80.9.0
matplotlib==3.10.5
dateparser==1.2.2
jinja2>=3.0.0
```
> Note: On Windows, the `windows-curses` package will be installed automatically to enable terminal UI features.
---
## Installation
### From PyPI
```bash
pip install py-json-analyzer
```
Upgrade to the latest version:
```bash
pip install --upgrade py-json-analyzer
```
### From Source
```bash
git clone https://github.com/MS-32154/py-json-analyzer
cd json_explorer
pip install .
```
### Development Mode
```bash
pip install -e .
```
---
## Running Tests
```bash
pytest
```
---
## CLI Usage
```
json_explorer [-h] [--url URL] [--interactive] [--tree {compact,analysis,raw}]
[--search SEARCH] [--search-type {key,value,pair,filter}]
[--search-value SEARCH_VALUE] [--search-mode {exact,contains,regex,startswith,endswith,case_insensitive}]
[--tree-results] [--stats] [--detailed] [--plot] [--plot-format {terminal,matplotlib,browser,all}]
[--save-path SAVE_PATH] [--no-browser]
[--generate LANGUAGE] [--output FILE] [--config FILE] [--package-name NAME] [--root-name NAME]
[--list-languages] [--language-info LANGUAGE] [--verbose]
[file]
JSON Explorer - Analyze, visualize, explore, and generate code from JSON data
positional arguments:
file Path to JSON file
options:
-h, --help show this help message and exit
--url URL URL to fetch JSON from
--interactive, -i Run in interactive mode
analysis options:
--tree {compact,analysis,raw}
Display JSON tree structure
--stats Show statistics
--detailed Show detailed analysis/statistics
search options:
--search SEARCH Search query or filter expression
--search-type {key,value,pair,filter}
Type of search to perform
--search-value SEARCH_VALUE
Value to search for (used with --search-type pair)
--search-mode {exact,contains,regex,startswith,endswith,case_insensitive}
Search mode
--tree-results Display search results in tree format
visualization options:
--plot Generate visualizations
--plot-format {terminal,matplotlib,browser,all}
Visualization format
--save-path SAVE_PATH
Path to save visualizations
--no-browser Don't open browser for HTML visualizations
code generation options:
--generate LANGUAGE, -g LANGUAGE
Generate code in specified language
--output FILE, -o FILE
Output file for generated code (default: stdout)
--config FILE JSON configuration file for code generation
--package-name NAME Package/namespace name for generated code
--root-name NAME Name for the root data structure (default: Root)
--list-languages List supported target languages and exit
--language-info LANGUAGE
Show detailed information about a specific language
--verbose Show generation result metadata
common generation options:
--no-comments Don't generate comments in output code
--struct-case {pascal,camel,snake}
Case style for struct/class names
--field-case {pascal,camel,snake}
Case style for field names
Go-specific options:
--no-pointers Don't use pointers for optional fields in Go
--no-json-tags Don't generate JSON struct tags in Go
--no-omitempty Don't add omitempty to JSON tags in Go
--json-tag-case {original,snake,camel}
Case style for JSON tag names in Go
```
### Examples
**Basic Analysis:**
```bash
json_explorer data.json --interactive
json_explorer data.json --tree compact --stats
json_explorer --url https://api.example.com/data --plot
```
**Search Examples:**
```bash
json_explorer data.json --search "name" --search-type key
json_explorer data.json --search "isinstance(value, int) and value > 10" --search-type filter
```
**Code Generation Examples:**
```bash
# List supported languages
json_explorer --list-languages
# Generate Go structs
json_explorer data.json --generate go
# Generate with custom configuration
json_explorer data.json --generate go --output models.go --package-name models
# Interactive code generation
json_explorer data.json --interactive # Then select code generation menu
```
### Screenshots
**Main Interactive Mode:**

**Code Generation Interface:**

---
## Library Usage
### Analysis & Exploration
```python
from json_explorer.stats import DataStatsAnalyzer
from json_explorer.analyzer import analyze_json
from json_explorer.search import JsonSearcher, SearchMode
from json_explorer.tree_view import print_json_analysis
from json_explorer.visualizer import JSONVisualizer
test_data = {
"users": [
{
"id": 1,
"name": "Alice",
"profile": {"age": 30, "settings": {"theme": "dark"}},
"tags": ["admin", "user"]
}
],
"metadata": {"total": 1, "created": "2024-01-01"}
}
# Statistical analysis
analyzer = DataStatsAnalyzer()
analyzer.print_summary(test_data, detailed=True)
# Structure inference
summary = analyze_json(test_data)
print(summary)
# Search functionality
searcher = JsonSearcher()
results = searcher.search_keys(test_data, "settings", SearchMode.CONTAINS) # Search keys containing "settings"
results = searcher.search_values(test_data, "@", SearchMode.CONTAINS, value_types={str}) # Search for values containing '@'
results = searcher.search_key_value_pairs(
test_data,
key_pattern="tags",
value_pattern="user",
value_mode=SearchMode.CONTAINS,
) # Searching for 'key' = 'tags' and values containing 'user'
results = searcher.search_with_filter(
test_data,
lambda k, v, d: isinstance(v, (int, float)) and v > 10
) # Filter values > 10
searcher.print_results(results, show_tree=True)
# Tree visualization
print_json_analysis(test_data, "Sample Data", show_raw=True)
# Data visualizations
visualizer = JSONVisualizer()
visualizer.visualize(test_data, output="terminal", detailed=True) # 'terminal', 'matplotlib', or 'browser' output
```
### Code Generation
```python
from json_explorer.codegen import (
generate_from_analysis,
quick_generate,
list_supported_languages,
get_language_info,
create_config
)
from json_explorer.analyzer import analyze_json
# Quick generation
go_code = quick_generate(test_data, language="go")
print(go_code)
# Detailed generation workflow
analysis = analyze_json(test_data)
config = create_config(
language="go",
package_name="models",
add_comments=True
)
result = generate_from_analysis(analysis, "go", config, "User")
if result.success:
print(result.code)
if result.warnings:
print("Warnings:", result.warnings)
# List available languages and info
languages = list_supported_languages()
print("Supported languages:", languages)
go_info = get_language_info("go")
print("Go generator info:", go_info)
# Interactive code generation
from json_explorer.codegen import create_interactive_handler
handler = create_interactive_handler(test_data)
handler.run_interactive() # Launches interactive interface
```
### Supported Languages
| Language | Status | Features |
| -------------- | --------------- | ------------------------------------------------ |
| **Go** | ✅ Full Support | Structs, JSON tags, pointers, configurable types |
| **Python** | 🚧 Coming Soon | Dataclasses, Pydantic models, type hints |
| **TypeScript** | 🚧 Coming Soon | Interfaces, types, optional properties |
| **Rust** | 🚧 Coming Soon | Structs, Serde annotations, Option types |
### Code Generation Features
- **Smart Type Detection**: Handles mixed types, conflicts, and unknown values
- **Configurable Output**: Multiple templates and naming conventions
- **Language-Specific Options**: Tailored features for each target language
- **Validation & Warnings**: Comprehensive validation with helpful warnings
- **Template System**: Extensible Jinja2-based template architecture
- **Interactive Configuration**: Guided setup with preview and validation
---
## Configuration
### Code Generation Config Example
```json
{
"package_name": "models",
"add_comments": true,
"generate_json_tags": true,
"json_tag_omitempty": true,
"struct_case": "pascal",
"field_case": "pascal",
"use_pointers_for_optional": true,
"int_type": "int64",
"float_type": "float64"
}
```
Load configuration:
```bash
json_explorer data.json --generate go --config config.json
```
---
## API Reference
For the complete API reference got to [JSON Explorer API Documentation](https://ms-32154.github.io/py-json-analyzer/) or see the source code.
---
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## Support
If you encounter any issues or have questions, please:
1. Check the [examples](#examples) section
2. Search existing [GitHub Issues](https://github.com/MS-32154/py-json-analyzer/issues)
3. Create a new issue with:
- Python version
- Operating system
- Minimal code example reproducing the issue
- Full error traceback (if applicable)
---
**JSON Explorer** – © 2025 MS-32154. All rights reserved.
Raw data
{
"_id": null,
"home_page": null,
"name": "py-json-analyzer",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "MS-32154",
"author_email": "MS-32154 <msttoffg@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/59/d5/1b5dd4979c1e29c5bd8a65a3dee4b691195866506a42b4946c472ec58231/py_json_analyzer-0.2.0.tar.gz",
"platform": null,
"description": "[](https://pypi.org/project/py-json-analyzer/)\n[](https://www.python.org/downloads/)\n[](https://opensource.org/licenses/MIT)\n\n# JSON Explorer\n\n**JSON Explorer** is a powerful CLI and Python library for analyzing, visualizing, exploring, and generating code from JSON data.\n\n---\n\n## Features\n\n### Analysis & Exploration\n\n- View JSON as a tree (compact, raw, or analytical)\n- Search by key, value, key-value pairs, or custom filter expressions\n- Generate statistical summaries and insights\n- Create visualizations in terminal, browser, or matplotlib\n- Interactive terminal exploration mode\n\n### Code Generation\n\n- Generate strongly-typed data structures from JSON\n- Multiple language support (Go, with Python, TypeScript, Rust coming soon)\n- Smart type detection and conflict resolution\n- Configurable naming conventions and templates\n- JSON serialization tags and annotations\n- Interactive configuration and preview\n\n### Library Features\n\n- Usable as a Python library with modular components\n- Extensible architecture for custom generators\n- Template-based code generation\n- Configuration profiles and validation\n\n---\n\n## Requirements\n\n- Python >= 3.9\n\nRequired packages:\n\n```\nnumpy==2.3.2\nrequests==2.32.5\nrich==14.1.0\nsetuptools==80.9.0\nmatplotlib==3.10.5\ndateparser==1.2.2\njinja2>=3.0.0\n```\n\n> Note: On Windows, the `windows-curses` package will be installed automatically to enable terminal UI features.\n\n---\n\n## Installation\n\n### From PyPI\n\n```bash\npip install py-json-analyzer\n```\n\nUpgrade to the latest version:\n\n```bash\npip install --upgrade py-json-analyzer\n```\n\n### From Source\n\n```bash\ngit clone https://github.com/MS-32154/py-json-analyzer\ncd json_explorer\npip install .\n```\n\n### Development Mode\n\n```bash\npip install -e .\n```\n\n---\n\n## Running Tests\n\n```bash\npytest\n```\n\n---\n\n## CLI Usage\n\n```\njson_explorer [-h] [--url URL] [--interactive] [--tree {compact,analysis,raw}]\n [--search SEARCH] [--search-type {key,value,pair,filter}]\n [--search-value SEARCH_VALUE] [--search-mode {exact,contains,regex,startswith,endswith,case_insensitive}]\n [--tree-results] [--stats] [--detailed] [--plot] [--plot-format {terminal,matplotlib,browser,all}]\n [--save-path SAVE_PATH] [--no-browser]\n [--generate LANGUAGE] [--output FILE] [--config FILE] [--package-name NAME] [--root-name NAME]\n [--list-languages] [--language-info LANGUAGE] [--verbose]\n [file]\n\nJSON Explorer - Analyze, visualize, explore, and generate code from JSON data\n\npositional arguments:\n file Path to JSON file\n\noptions:\n -h, --help show this help message and exit\n --url URL URL to fetch JSON from\n --interactive, -i Run in interactive mode\n\nanalysis options:\n --tree {compact,analysis,raw}\n Display JSON tree structure\n --stats Show statistics\n --detailed Show detailed analysis/statistics\n\nsearch options:\n --search SEARCH Search query or filter expression\n --search-type {key,value,pair,filter}\n Type of search to perform\n --search-value SEARCH_VALUE\n Value to search for (used with --search-type pair)\n --search-mode {exact,contains,regex,startswith,endswith,case_insensitive}\n Search mode\n --tree-results Display search results in tree format\n\nvisualization options:\n --plot Generate visualizations\n --plot-format {terminal,matplotlib,browser,all}\n Visualization format\n --save-path SAVE_PATH\n Path to save visualizations\n --no-browser Don't open browser for HTML visualizations\n\ncode generation options:\n --generate LANGUAGE, -g LANGUAGE\n Generate code in specified language\n --output FILE, -o FILE\n Output file for generated code (default: stdout)\n --config FILE JSON configuration file for code generation\n --package-name NAME Package/namespace name for generated code\n --root-name NAME Name for the root data structure (default: Root)\n --list-languages List supported target languages and exit\n --language-info LANGUAGE\n Show detailed information about a specific language\n --verbose Show generation result metadata\n\ncommon generation options:\n --no-comments Don't generate comments in output code\n --struct-case {pascal,camel,snake}\n Case style for struct/class names\n --field-case {pascal,camel,snake}\n Case style for field names\n\nGo-specific options:\n --no-pointers Don't use pointers for optional fields in Go\n --no-json-tags Don't generate JSON struct tags in Go\n --no-omitempty Don't add omitempty to JSON tags in Go\n --json-tag-case {original,snake,camel}\n Case style for JSON tag names in Go\n```\n\n### Examples\n\n**Basic Analysis:**\n\n```bash\njson_explorer data.json --interactive\njson_explorer data.json --tree compact --stats\njson_explorer --url https://api.example.com/data --plot\n```\n\n**Search Examples:**\n\n```bash\njson_explorer data.json --search \"name\" --search-type key\njson_explorer data.json --search \"isinstance(value, int) and value > 10\" --search-type filter\n```\n\n**Code Generation Examples:**\n\n```bash\n# List supported languages\njson_explorer --list-languages\n\n# Generate Go structs\njson_explorer data.json --generate go\n\n# Generate with custom configuration\njson_explorer data.json --generate go --output models.go --package-name models\n\n# Interactive code generation\njson_explorer data.json --interactive # Then select code generation menu\n```\n\n### Screenshots\n\n**Main Interactive Mode:**\n\n\n**Code Generation Interface:**\n\n\n---\n\n## Library Usage\n\n### Analysis & Exploration\n\n```python\nfrom json_explorer.stats import DataStatsAnalyzer\nfrom json_explorer.analyzer import analyze_json\nfrom json_explorer.search import JsonSearcher, SearchMode\nfrom json_explorer.tree_view import print_json_analysis\nfrom json_explorer.visualizer import JSONVisualizer\n\ntest_data = {\n \"users\": [\n {\n \"id\": 1,\n \"name\": \"Alice\",\n \"profile\": {\"age\": 30, \"settings\": {\"theme\": \"dark\"}},\n \"tags\": [\"admin\", \"user\"]\n }\n ],\n \"metadata\": {\"total\": 1, \"created\": \"2024-01-01\"}\n}\n\n# Statistical analysis\nanalyzer = DataStatsAnalyzer()\nanalyzer.print_summary(test_data, detailed=True)\n\n# Structure inference\nsummary = analyze_json(test_data)\nprint(summary)\n\n# Search functionality\nsearcher = JsonSearcher()\n\nresults = searcher.search_keys(test_data, \"settings\", SearchMode.CONTAINS) # Search keys containing \"settings\"\n\nresults = searcher.search_values(test_data, \"@\", SearchMode.CONTAINS, value_types={str}) # Search for values containing '@'\n\nresults = searcher.search_key_value_pairs(\n test_data,\n key_pattern=\"tags\",\n value_pattern=\"user\",\n value_mode=SearchMode.CONTAINS,\n) # Searching for 'key' = 'tags' and values containing 'user'\n\nresults = searcher.search_with_filter(\n test_data,\n lambda k, v, d: isinstance(v, (int, float)) and v > 10\n) # Filter values > 10\nsearcher.print_results(results, show_tree=True)\n\n# Tree visualization\nprint_json_analysis(test_data, \"Sample Data\", show_raw=True)\n\n# Data visualizations\nvisualizer = JSONVisualizer()\nvisualizer.visualize(test_data, output=\"terminal\", detailed=True) # 'terminal', 'matplotlib', or 'browser' output\n```\n\n### Code Generation\n\n```python\nfrom json_explorer.codegen import (\n generate_from_analysis,\n quick_generate,\n list_supported_languages,\n get_language_info,\n create_config\n)\nfrom json_explorer.analyzer import analyze_json\n\n# Quick generation\ngo_code = quick_generate(test_data, language=\"go\")\nprint(go_code)\n\n# Detailed generation workflow\nanalysis = analyze_json(test_data)\nconfig = create_config(\n language=\"go\",\n package_name=\"models\",\n add_comments=True\n)\nresult = generate_from_analysis(analysis, \"go\", config, \"User\")\n\nif result.success:\n print(result.code)\n if result.warnings:\n print(\"Warnings:\", result.warnings)\n\n# List available languages and info\nlanguages = list_supported_languages()\nprint(\"Supported languages:\", languages)\n\ngo_info = get_language_info(\"go\")\nprint(\"Go generator info:\", go_info)\n\n# Interactive code generation\nfrom json_explorer.codegen import create_interactive_handler\n\nhandler = create_interactive_handler(test_data)\nhandler.run_interactive() # Launches interactive interface\n```\n\n### Supported Languages\n\n| Language | Status | Features |\n| -------------- | --------------- | ------------------------------------------------ |\n| **Go** | \u2705 Full Support | Structs, JSON tags, pointers, configurable types |\n| **Python** | \ud83d\udea7 Coming Soon | Dataclasses, Pydantic models, type hints |\n| **TypeScript** | \ud83d\udea7 Coming Soon | Interfaces, types, optional properties |\n| **Rust** | \ud83d\udea7 Coming Soon | Structs, Serde annotations, Option types |\n\n### Code Generation Features\n\n- **Smart Type Detection**: Handles mixed types, conflicts, and unknown values\n- **Configurable Output**: Multiple templates and naming conventions\n- **Language-Specific Options**: Tailored features for each target language\n- **Validation & Warnings**: Comprehensive validation with helpful warnings\n- **Template System**: Extensible Jinja2-based template architecture\n- **Interactive Configuration**: Guided setup with preview and validation\n\n---\n\n## Configuration\n\n### Code Generation Config Example\n\n```json\n{\n \"package_name\": \"models\",\n \"add_comments\": true,\n \"generate_json_tags\": true,\n \"json_tag_omitempty\": true,\n \"struct_case\": \"pascal\",\n \"field_case\": \"pascal\",\n \"use_pointers_for_optional\": true,\n \"int_type\": \"int64\",\n \"float_type\": \"float64\"\n}\n```\n\nLoad configuration:\n\n```bash\njson_explorer data.json --generate go --config config.json\n```\n\n---\n\n## API Reference\n\nFor the complete API reference got to [JSON Explorer API Documentation](https://ms-32154.github.io/py-json-analyzer/) or see the source code.\n\n---\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## Support\n\nIf you encounter any issues or have questions, please:\n\n1. Check the [examples](#examples) section\n2. Search existing [GitHub Issues](https://github.com/MS-32154/py-json-analyzer/issues)\n3. Create a new issue with:\n - Python version\n - Operating system\n - Minimal code example reproducing the issue\n - Full error traceback (if applicable)\n\n---\n\n**JSON Explorer** \u2013 \u00a9 2025 MS-32154. All rights reserved.\n",
"bugtrack_url": null,
"license": null,
"summary": "A powerful CLI and Python library for analyzing, visualizing, exploring, and generating code from JSON data",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "71bad28ba2257d9e6dec3742bc129dd553804a153ac5419c2b3e9e33f9481d92",
"md5": "2c5023e19eed525e815e9d6a098e734f",
"sha256": "a3e40df7a67267ba5b3d100fa6e8469e9de656882fd100df02a179e8d7870d68"
},
"downloads": -1,
"filename": "py_json_analyzer-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2c5023e19eed525e815e9d6a098e734f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 78494,
"upload_time": "2025-08-20T10:20:44",
"upload_time_iso_8601": "2025-08-20T10:20:44.773546Z",
"url": "https://files.pythonhosted.org/packages/71/ba/d28ba2257d9e6dec3742bc129dd553804a153ac5419c2b3e9e33f9481d92/py_json_analyzer-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "59d51b5dd4979c1e29c5bd8a65a3dee4b691195866506a42b4946c472ec58231",
"md5": "eb349a16a2f179b5bd38126fb467f8fb",
"sha256": "da153233f844bbfa8a478234588a37031735e40c6ccbf038a0cffaa5fa618c4c"
},
"downloads": -1,
"filename": "py_json_analyzer-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "eb349a16a2f179b5bd38126fb467f8fb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 68708,
"upload_time": "2025-08-20T10:20:45",
"upload_time_iso_8601": "2025-08-20T10:20:45.983798Z",
"url": "https://files.pythonhosted.org/packages/59/d5/1b5dd4979c1e29c5bd8a65a3dee4b691195866506a42b4946c472ec58231/py_json_analyzer-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-20 10:20:45",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "py-json-analyzer"
}