py-json-analyzer 0.3.0__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py_json_analyzer-0.5.0/PKG-INFO +802 -0
- py_json_analyzer-0.5.0/README.md +767 -0
- py_json_analyzer-0.5.0/json_explorer/__init__.py +34 -0
- py_json_analyzer-0.5.0/json_explorer/analyzer.py +205 -0
- py_json_analyzer-0.5.0/json_explorer/cli.py +161 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/json_explorer/codegen/__init__.py +51 -61
- py_json_analyzer-0.5.0/json_explorer/codegen/cli_integration.py +469 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/core/__init__.py +52 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/json_explorer/codegen/core/config.py +90 -162
- py_json_analyzer-0.5.0/json_explorer/codegen/core/generator.py +243 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/core/naming.py +136 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/core/plugin.py +71 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/core/schema.py +310 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/core/templates.py +44 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/__init__.py +1 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/go/__init__.py +14 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/go/config.py +62 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/go/generator.py +147 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/go/naming.py +54 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/go/plugin.py +31 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/go/templates/complete_file.go.j2 +34 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/python/__init__.py +15 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/python/config.py +101 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/python/generator.py +220 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/python/naming.py +94 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/python/plugin.py +45 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/python/templates/dataclass_file.py.j2 +31 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/python/templates/pydantic_file.py.j2 +33 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/python/templates/typeddict_file.py.j2 +36 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/rust/__init__.py +15 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/rust/config.py +18 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/rust/generator.py +155 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/rust/naming.py +65 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/rust/plugin.py +23 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/rust/templates/file.rs.j2 +10 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/typescript/__init__.py +15 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/typescript/config.py +29 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/typescript/generator.py +195 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/typescript/naming.py +71 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/typescript/plugin.py +24 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/languages/typescript/templates/file.ts.j2 +9 -0
- py_json_analyzer-0.5.0/json_explorer/codegen/registry.py +150 -0
- py_json_analyzer-0.5.0/json_explorer/errors.py +14 -0
- py_json_analyzer-0.5.0/json_explorer/json_schema.py +86 -0
- py_json_analyzer-0.5.0/json_explorer/logging_config.py +72 -0
- py_json_analyzer-0.5.0/json_explorer/main.py +295 -0
- py_json_analyzer-0.5.0/json_explorer/search.py +261 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/json_explorer/stats.py +144 -94
- py_json_analyzer-0.5.0/json_explorer/tree_view.py +85 -0
- py_json_analyzer-0.5.0/json_explorer/tui.py +487 -0
- py_json_analyzer-0.5.0/json_explorer/ui.py +38 -0
- py_json_analyzer-0.5.0/json_explorer/utils.py +147 -0
- py_json_analyzer-0.5.0/json_explorer/visualizer.py +421 -0
- py_json_analyzer-0.5.0/py_json_analyzer.egg-info/PKG-INFO +802 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/py_json_analyzer.egg-info/SOURCES.txt +32 -9
- py_json_analyzer-0.5.0/py_json_analyzer.egg-info/requires.txt +6 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/py_json_analyzer.egg-info/top_level.txt +0 -1
- py_json_analyzer-0.5.0/pyproject.toml +186 -0
- py_json_analyzer-0.5.0/setup.cfg +4 -0
- py_json_analyzer-0.5.0/tests/test_analyzer.py +169 -0
- py_json_analyzer-0.5.0/tests/test_cli.py +225 -0
- py_json_analyzer-0.5.0/tests/test_codegen_compiles.py +432 -0
- py_json_analyzer-0.5.0/tests/test_docs.py +163 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/tests/test_gen_core_config.py +43 -9
- py_json_analyzer-0.5.0/tests/test_gen_core_naming.py +198 -0
- py_json_analyzer-0.5.0/tests/test_gen_core_schema.py +146 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/tests/test_gen_edge.py +42 -49
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/tests/test_gen_error_handling.py +1 -9
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/tests/test_gen_integration.py +6 -5
- py_json_analyzer-0.5.0/tests/test_gen_performance.py +28 -0
- py_json_analyzer-0.5.0/tests/test_gen_registry.py +179 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/tests/test_gen_templates.py +0 -9
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/tests/test_go_generator.py +59 -48
- py_json_analyzer-0.5.0/tests/test_json_schema.py +159 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/tests/test_python_generator.py +43 -18
- py_json_analyzer-0.5.0/tests/test_rust_generator.py +101 -0
- py_json_analyzer-0.5.0/tests/test_search.py +253 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/tests/test_stats.py +9 -11
- py_json_analyzer-0.5.0/tests/test_tree_view.py +118 -0
- py_json_analyzer-0.5.0/tests/test_tui.py +260 -0
- py_json_analyzer-0.5.0/tests/test_typescript_generator.py +133 -0
- py_json_analyzer-0.5.0/tests/test_utils.py +426 -0
- py_json_analyzer-0.5.0/tests/test_visualizer.py +111 -0
- py_json_analyzer-0.3.0/PKG-INFO +0 -492
- py_json_analyzer-0.3.0/README.md +0 -473
- py_json_analyzer-0.3.0/json_explorer/__init__.py +0 -1
- py_json_analyzer-0.3.0/json_explorer/analyzer.py +0 -262
- py_json_analyzer-0.3.0/json_explorer/cli.py +0 -139
- py_json_analyzer-0.3.0/json_explorer/codegen/cli_integration.py +0 -669
- py_json_analyzer-0.3.0/json_explorer/codegen/core/__init__.py +0 -98
- py_json_analyzer-0.3.0/json_explorer/codegen/core/generator.py +0 -378
- py_json_analyzer-0.3.0/json_explorer/codegen/core/naming.py +0 -337
- py_json_analyzer-0.3.0/json_explorer/codegen/core/schema.py +0 -582
- py_json_analyzer-0.3.0/json_explorer/codegen/core/templates.py +0 -284
- py_json_analyzer-0.3.0/json_explorer/codegen/interactive.py +0 -779
- py_json_analyzer-0.3.0/json_explorer/codegen/languages/__init__.py +0 -189
- py_json_analyzer-0.3.0/json_explorer/codegen/languages/go/__init__.py +0 -37
- py_json_analyzer-0.3.0/json_explorer/codegen/languages/go/config.py +0 -225
- py_json_analyzer-0.3.0/json_explorer/codegen/languages/go/generator.py +0 -333
- py_json_analyzer-0.3.0/json_explorer/codegen/languages/go/interactive.py +0 -279
- py_json_analyzer-0.3.0/json_explorer/codegen/languages/go/naming.py +0 -103
- py_json_analyzer-0.3.0/json_explorer/codegen/languages/python/__init__.py +0 -43
- py_json_analyzer-0.3.0/json_explorer/codegen/languages/python/config.py +0 -328
- py_json_analyzer-0.3.0/json_explorer/codegen/languages/python/generator.py +0 -422
- py_json_analyzer-0.3.0/json_explorer/codegen/languages/python/interactive.py +0 -344
- py_json_analyzer-0.3.0/json_explorer/codegen/languages/python/naming.py +0 -157
- py_json_analyzer-0.3.0/json_explorer/codegen/registry.py +0 -395
- py_json_analyzer-0.3.0/json_explorer/filter_parser.py +0 -132
- py_json_analyzer-0.3.0/json_explorer/interactive.py +0 -504
- py_json_analyzer-0.3.0/json_explorer/main.py +0 -228
- py_json_analyzer-0.3.0/json_explorer/search.py +0 -423
- py_json_analyzer-0.3.0/json_explorer/tree_view.py +0 -161
- py_json_analyzer-0.3.0/json_explorer/utils.py +0 -114
- py_json_analyzer-0.3.0/json_explorer/visualizer.py +0 -1060
- py_json_analyzer-0.3.0/py_json_analyzer.egg-info/PKG-INFO +0 -492
- py_json_analyzer-0.3.0/py_json_analyzer.egg-info/requires.txt +0 -9
- py_json_analyzer-0.3.0/pyproject.toml +0 -26
- py_json_analyzer-0.3.0/setup.cfg +0 -29
- py_json_analyzer-0.3.0/setup.py +0 -3
- py_json_analyzer-0.3.0/tests/test_analyzer.py +0 -85
- py_json_analyzer-0.3.0/tests/test_gen_conftest.py +0 -54
- py_json_analyzer-0.3.0/tests/test_gen_core_naming.py +0 -81
- py_json_analyzer-0.3.0/tests/test_gen_core_schema.py +0 -161
- py_json_analyzer-0.3.0/tests/test_gen_performance.py +0 -37
- py_json_analyzer-0.3.0/tests/test_gen_registry.py +0 -110
- py_json_analyzer-0.3.0/tests/test_search.py +0 -192
- py_json_analyzer-0.3.0/tests/test_tree_view.py +0 -188
- py_json_analyzer-0.3.0/tests/test_utils.py +0 -109
- py_json_analyzer-0.3.0/tests/test_visualizer.py +0 -96
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/LICENSE +0 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/json_explorer/__main__.py +0 -0
- /py_json_analyzer-0.3.0/tests/__init__.py → /py_json_analyzer-0.5.0/json_explorer/py.typed +0 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/py_json_analyzer.egg-info/dependency_links.txt +0 -0
- {py_json_analyzer-0.3.0 → py_json_analyzer-0.5.0}/py_json_analyzer.egg-info/entry_points.txt +0 -0
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-json-analyzer
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: A powerful CLI and Python library for analyzing, visualizing, exploring, and generating code from JSON data
|
|
5
|
+
Author-email: MS-32154 <msttoffg@gmail.com>
|
|
6
|
+
Maintainer-email: MS-32154 <msttoffg@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/MS-32154/py-json-analyzer
|
|
9
|
+
Project-URL: Documentation, https://ms-32154.github.io/py-json-analyzer/
|
|
10
|
+
Project-URL: Repository, https://github.com/MS-32154/py-json-analyzer
|
|
11
|
+
Project-URL: Bug Tracker, https://github.com/MS-32154/py-json-analyzer/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/MS-32154/py-json-analyzer/blob/main/CHANGELOG.md
|
|
13
|
+
Keywords: json,analyzer,visualization,json-statistics,plot,jmespath,json-search,cli,tui,data-analysis,schema,code-generation,go,json-to-go,json-to-golang,python,pydantic,dataclass,json-to-python
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
20
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
21
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.14
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: jmespath>=1.0.1
|
|
29
|
+
Requires-Dist: rich>=13.0.0
|
|
30
|
+
Requires-Dist: plotly>=5.0.0
|
|
31
|
+
Requires-Dist: requests>=2.32.0
|
|
32
|
+
Requires-Dist: jinja2>=3.0.0
|
|
33
|
+
Requires-Dist: textual>=8.2
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
[](https://pypi.org/project/py-json-analyzer/)
|
|
37
|
+
[](https://www.python.org/downloads/)
|
|
38
|
+
[](https://opensource.org/licenses/MIT)
|
|
39
|
+
|
|
40
|
+
# JSON Explorer
|
|
41
|
+
|
|
42
|
+
**JSON Explorer** is a powerful CLI and Python library for analyzing, visualizing, exploring, and generating code from JSON data. Built with modern Python practices and featuring JMESPath-powered search capabilities.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
### Analysis & Exploration
|
|
49
|
+
|
|
50
|
+
- **Structural Analysis**: infers one type per position from every value seen (optional keys, nullable
|
|
51
|
+
values, int/float widening, mixed types) and detects standard string formats (RFC 3339 date-times,
|
|
52
|
+
dates, times, durations)
|
|
53
|
+
- **JMESPath Search**: Industry-standard query language for powerful JSON searching and filtering
|
|
54
|
+
- **Tree Visualization**: Multiple view modes (compact, analytical, raw) with rich terminal output
|
|
55
|
+
- **Statistical Analysis**: Comprehensive data quality metrics and structural insights
|
|
56
|
+
- **Visualization**: text charts in the terminal, an interactive HTML report (Plotly), or both
|
|
57
|
+
- **JSON Schema export**: a draft 2020-12 schema of the data (`--json-schema`) for validation or for
|
|
58
|
+
other code generators
|
|
59
|
+
- **Terminal UI**: a full-screen app (Textual) with the data, its structure, live JMESPath search,
|
|
60
|
+
statistics and code generation with a live preview, side by side in tabs
|
|
61
|
+
|
|
62
|
+
### Code Generation
|
|
63
|
+
|
|
64
|
+
- **Go**: structs with JSON tags, pointers for optional fields, `time.Time` for RFC 3339 date-times;
|
|
65
|
+
gofmt-clean output
|
|
66
|
+
- **Python**: dataclasses, Pydantic v2 models (aliases for renamed keys, `datetime`/`date`/`time`/
|
|
67
|
+
`timedelta`) or TypedDicts (original keys); ruff/black-formatted output
|
|
68
|
+
- **TypeScript**: interfaces, or Zod 4 schemas with inferred types; keys kept as in the JSON,
|
|
69
|
+
`key?:` for missing keys, `| null` for null values, unions for mixed values; Prettier-formatted
|
|
70
|
+
- **Rust**: structs with serde derives; `Option<T>` for missing or null values, `rename` for keys that
|
|
71
|
+
aren't snake_case, raw identifiers for keywords, `serde_json::Value` for mixed values; rustfmt-clean
|
|
72
|
+
- **Correct names**: types named after their keys (`TeamLead`, `Project`), every name planned once so
|
|
73
|
+
declarations and references agree, keys escaped or mapped with aliases
|
|
74
|
+
- **Verified output**: the test suite compiles the generated code and decodes the source data with it
|
|
75
|
+
- **Configuration**: JSON config file, CLI flags, or the options panel in the terminal UI;
|
|
76
|
+
invalid options fail with a clear message
|
|
77
|
+
|
|
78
|
+
### Library Features
|
|
79
|
+
|
|
80
|
+
- **Modular Architecture**: Use individual components independently
|
|
81
|
+
- **Language plugins**: add a target language as a package (or install one through the
|
|
82
|
+
`json_explorer.languages` entry point)
|
|
83
|
+
- **Typed**: ships `py.typed`; type-checks cleanly with mypy
|
|
84
|
+
- **Quiet as a library**: logs only when the application configures logging
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Requirements
|
|
89
|
+
|
|
90
|
+
- **Python**: 3.15 or higher (Linux/macOS); 3.14 or higher on Windows
|
|
91
|
+
|
|
92
|
+
### Core Dependencies
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
jmespath>=1.0.1 # JMESPath query language
|
|
96
|
+
jinja2>=3.0.0 # Template engine for code generation
|
|
97
|
+
plotly>=5.0.0 # Interactive, browser-based graphing
|
|
98
|
+
requests>=2.32.0 # HTTP requests for URL loading
|
|
99
|
+
rich>=13.0.0 # Rich terminal formatting
|
|
100
|
+
textual>=8.2 # Terminal UI
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Development Dependencies (`dev` dependency group)
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
pytest>=7.0.0
|
|
107
|
+
pytest-cov>=4.0.0
|
|
108
|
+
ruff>=0.17.0
|
|
109
|
+
mypy>=1.0.0
|
|
110
|
+
types-requests>=2.31.0
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Installation
|
|
116
|
+
|
|
117
|
+
### From PyPI (Recommended)
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
pip install py-json-analyzer
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Upgrade to the latest version:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
pip install --upgrade py-json-analyzer
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### From Source
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
git clone https://github.com/MS-32154/py-json-analyzer
|
|
133
|
+
cd py-json-analyzer
|
|
134
|
+
uv sync # or: pip install -e .
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
For development with all optional dependencies:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
uv sync # installs the dev group; or (pip >= 25.1): pip install -e . --group dev
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Quick Start
|
|
146
|
+
|
|
147
|
+
### Command Line
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Terminal UI (the default when no action is given)
|
|
151
|
+
json_explorer data.json
|
|
152
|
+
|
|
153
|
+
# Quick analysis
|
|
154
|
+
json_explorer data.json --tree compact --stats
|
|
155
|
+
|
|
156
|
+
# JMESPath search
|
|
157
|
+
json_explorer data.json --search "users[*].email"
|
|
158
|
+
|
|
159
|
+
# Generate Go code
|
|
160
|
+
json_explorer data.json --generate go --output models.go
|
|
161
|
+
|
|
162
|
+
# Generate Pydantic models
|
|
163
|
+
json_explorer data.json --generate python --python-style pydantic --output models.py
|
|
164
|
+
|
|
165
|
+
# Create visualizations
|
|
166
|
+
json_explorer data.json --plot --plot-format html
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Python Library
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
from json_explorer import analyze_json, JsonSearcher
|
|
173
|
+
from json_explorer.codegen import quick_generate
|
|
174
|
+
|
|
175
|
+
# Analyze structure
|
|
176
|
+
data = {"users": [{"id": 1, "name": "Alice", "email": "alice@example.com"}]}
|
|
177
|
+
analysis = analyze_json(data)
|
|
178
|
+
print(analysis)
|
|
179
|
+
|
|
180
|
+
# JMESPath search
|
|
181
|
+
searcher = JsonSearcher()
|
|
182
|
+
result = searcher.search(data, "users[*].email")
|
|
183
|
+
searcher.print_result(result)
|
|
184
|
+
|
|
185
|
+
# Generate code
|
|
186
|
+
go_code = quick_generate(data, language="go", package_name="models")
|
|
187
|
+
python_code = quick_generate(data, language="python", style="pydantic")
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## CLI Usage
|
|
193
|
+
|
|
194
|
+
### Basic Commands
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
json_explorer [FILE] [OPTIONS]
|
|
198
|
+
|
|
199
|
+
# Data Sources
|
|
200
|
+
json_explorer data.json # Load from file
|
|
201
|
+
json_explorer --url https://api.example.com/data # Load from URL
|
|
202
|
+
|
|
203
|
+
# Display Modes
|
|
204
|
+
--interactive, -i # Terminal UI (default without other actions)
|
|
205
|
+
--tree {compact,analysis,raw} # Display tree structure
|
|
206
|
+
--stats # Show statistics
|
|
207
|
+
--detailed # Show detailed information
|
|
208
|
+
--plot # Generate visualizations
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Terminal UI
|
|
212
|
+
|
|
213
|
+
`json_explorer data.json` (or `--interactive`) opens a full-screen terminal UI with five tabs:
|
|
214
|
+
|
|
215
|
+
| Tab | Key | Shows |
|
|
216
|
+
|---|---|---|
|
|
217
|
+
| Data | `1` | The document as a tree; large containers expand on demand |
|
|
218
|
+
| Structure | `2` | The inferred types: optional keys, nullable values, formats, mixed kinds |
|
|
219
|
+
| Search | `3` | JMESPath queries, checked as you type, with the result as JSON and examples |
|
|
220
|
+
| Statistics | `4` | Size, depth, complexity and quality issues; opens the HTML report |
|
|
221
|
+
| Code | `5` | Every language and JSON Schema with a live preview; options come from each language's flags |
|
|
222
|
+
|
|
223
|
+
Other keys: `/` search, `Esc` leave a text box, `Ctrl+S` save the generated code, `Ctrl+Y` copy it,
|
|
224
|
+
`q` quit.
|
|
225
|
+
The UI needs a terminal; in scripts and pipes use the flags below.
|
|
226
|
+
|
|
227
|
+
### JMESPath Search
|
|
228
|
+
|
|
229
|
+
The search functionality now uses [JMESPath](https://jmespath.org/), an industry-standard query language for JSON:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# Basic path expressions
|
|
233
|
+
json_explorer data.json --search "users" # Get users array
|
|
234
|
+
json_explorer data.json --search "users[0]" # First user
|
|
235
|
+
json_explorer data.json --search "users[*].name" # All names
|
|
236
|
+
|
|
237
|
+
# Filtering
|
|
238
|
+
json_explorer data.json --search "users[?age > \`30\`]" # Filter by age
|
|
239
|
+
json_explorer data.json --search "users[?active == \`true\`]" # Filter by boolean
|
|
240
|
+
|
|
241
|
+
# Functions
|
|
242
|
+
json_explorer data.json --search "length(users)" # Count users
|
|
243
|
+
json_explorer data.json --search "sort_by(users, &age)" # Sort by field
|
|
244
|
+
json_explorer data.json --search "max_by(users, &age).name" # Get name of oldest
|
|
245
|
+
|
|
246
|
+
# Projections (field selection)
|
|
247
|
+
json_explorer data.json --search "users[*].{name: name, email: email}"
|
|
248
|
+
|
|
249
|
+
# Complex queries
|
|
250
|
+
json_explorer data.json --search "users[?age > \`30\` && active == \`true\`].name"
|
|
251
|
+
|
|
252
|
+
# Display options
|
|
253
|
+
--tree-results # Show results as tree
|
|
254
|
+
--show-examples # Display JMESPath examples
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**JMESPath Resources:**
|
|
258
|
+
|
|
259
|
+
- [Tutorial](https://jmespath.org/tutorial.html)
|
|
260
|
+
- [Specification](https://jmespath.org/specification.html)
|
|
261
|
+
- [Online Playground](https://jmespath.org/)
|
|
262
|
+
|
|
263
|
+
### Code Generation
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# List supported languages
|
|
267
|
+
json_explorer --list-languages
|
|
268
|
+
|
|
269
|
+
# Get language details
|
|
270
|
+
json_explorer --language-info go
|
|
271
|
+
json_explorer --language-info python
|
|
272
|
+
|
|
273
|
+
# Generate Go code
|
|
274
|
+
json_explorer data.json --generate go \
|
|
275
|
+
--output models.go \
|
|
276
|
+
--package-name models \
|
|
277
|
+
--root-name User
|
|
278
|
+
|
|
279
|
+
# Go-specific options
|
|
280
|
+
--no-pointers # Don't use pointers for optional fields
|
|
281
|
+
|
|
282
|
+
# Generate Python code
|
|
283
|
+
json_explorer data.json --generate python \
|
|
284
|
+
--output models.py \
|
|
285
|
+
--python-style {dataclass,pydantic,typeddict}
|
|
286
|
+
|
|
287
|
+
# Python-specific options
|
|
288
|
+
--frozen # Make dataclasses immutable
|
|
289
|
+
--no-slots # Don't use __slots__
|
|
290
|
+
--no-kw-only # Positional fields (default: keyword-only)
|
|
291
|
+
--pydantic-forbid-extra # Forbid extra fields in Pydantic
|
|
292
|
+
|
|
293
|
+
# TypeScript-specific options
|
|
294
|
+
--ts-style {interface,zod} # Interfaces (default) or Zod schemas
|
|
295
|
+
|
|
296
|
+
# Rust-specific options
|
|
297
|
+
--rust-deny-unknown # #[serde(deny_unknown_fields)]
|
|
298
|
+
|
|
299
|
+
# Common options
|
|
300
|
+
--config config.json # Load configuration from file
|
|
301
|
+
--no-comments # Don't generate comments
|
|
302
|
+
--verbose # Show detailed generation info
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### JSON Schema
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Print a JSON Schema (draft 2020-12) of the data
|
|
309
|
+
json_explorer data.json --json-schema > data.schema.json
|
|
310
|
+
json_explorer data.json --json-schema --output data.schema.json --root-name Users
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Visualization
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# Terminal visualization (text charts)
|
|
317
|
+
json_explorer data.json --plot --plot-format terminal
|
|
318
|
+
|
|
319
|
+
# Interactive HTML (Plotly)
|
|
320
|
+
json_explorer data.json --plot --plot-format html
|
|
321
|
+
|
|
322
|
+
# All formats
|
|
323
|
+
json_explorer data.json --plot --plot-format all
|
|
324
|
+
|
|
325
|
+
# Options
|
|
326
|
+
--detailed # Generate detailed charts
|
|
327
|
+
--save-path output.html # Save to specific file
|
|
328
|
+
--no-browser # Don't auto-open browser
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Logging
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
--log-level {DEBUG,INFO,WARNING,ERROR}
|
|
335
|
+
--log-file output.log
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Python API
|
|
341
|
+
|
|
342
|
+
### Core Analysis
|
|
343
|
+
|
|
344
|
+
```python
|
|
345
|
+
from json_explorer import analyze_json, load_json
|
|
346
|
+
|
|
347
|
+
# Load data
|
|
348
|
+
source, data = load_json("data.json")
|
|
349
|
+
# or
|
|
350
|
+
source, data = load_json(url="https://api.example.com/data")
|
|
351
|
+
|
|
352
|
+
# Analyze structure
|
|
353
|
+
analysis = analyze_json(data)
|
|
354
|
+
print(f"Kind: {analysis.kind}") # object, array, string, ...
|
|
355
|
+
print(f"Fields: {list(analysis.fields)}") # for objects
|
|
356
|
+
print(analysis.to_dict()) # plain-dict form
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### JMESPath Search
|
|
360
|
+
|
|
361
|
+
```python
|
|
362
|
+
from json_explorer import JsonSearcher
|
|
363
|
+
|
|
364
|
+
searcher = JsonSearcher()
|
|
365
|
+
|
|
366
|
+
# Basic search
|
|
367
|
+
result = searcher.search(data, "users[*].email")
|
|
368
|
+
if result:
|
|
369
|
+
searcher.print_result(result)
|
|
370
|
+
|
|
371
|
+
# Several queries
|
|
372
|
+
results = {q: searcher.search(data, q) for q in ["users[*].name", "length(users)"]}
|
|
373
|
+
|
|
374
|
+
# Validate query before executing
|
|
375
|
+
valid, error = searcher.validate_query("users[*].invalid...")
|
|
376
|
+
if valid:
|
|
377
|
+
result = searcher.search(data, query)
|
|
378
|
+
|
|
379
|
+
# Get example queries
|
|
380
|
+
examples = searcher.get_query_examples()
|
|
381
|
+
searcher.print_examples()
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
### JSON Schema
|
|
385
|
+
|
|
386
|
+
```python
|
|
387
|
+
from json_explorer import json_schema
|
|
388
|
+
|
|
389
|
+
schema = json_schema(data, title="Users") # dict, draft 2020-12
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### Statistics & Analysis
|
|
393
|
+
|
|
394
|
+
```python
|
|
395
|
+
from json_explorer import DataStatsAnalyzer, generate_stats
|
|
396
|
+
|
|
397
|
+
# Generate statistics
|
|
398
|
+
analyzer = DataStatsAnalyzer()
|
|
399
|
+
stats = analyzer.generate_stats(data)
|
|
400
|
+
|
|
401
|
+
# Print formatted summary
|
|
402
|
+
analyzer.print_summary(data, detailed=True)
|
|
403
|
+
|
|
404
|
+
# Or use convenience function
|
|
405
|
+
stats = generate_stats(data)
|
|
406
|
+
print(f"Total values: {stats['total_values']}")
|
|
407
|
+
print(f"Max depth: {stats['max_depth']}")
|
|
408
|
+
print(f"Complexity: {stats['computed_insights']['complexity_score']}")
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### Visualization
|
|
412
|
+
|
|
413
|
+
```python
|
|
414
|
+
from json_explorer import JSONVisualizer, visualize_json
|
|
415
|
+
|
|
416
|
+
# Create visualizer
|
|
417
|
+
visualizer = JSONVisualizer()
|
|
418
|
+
|
|
419
|
+
# Terminal visualization
|
|
420
|
+
visualizer.visualize(data, output="terminal", detailed=True)
|
|
421
|
+
|
|
422
|
+
# HTML visualization
|
|
423
|
+
visualizer.visualize(
|
|
424
|
+
data, output="html", save_path="report.html", detailed=True, open_browser=True
|
|
425
|
+
)
|
|
426
|
+
|
|
427
|
+
# Or use convenience function
|
|
428
|
+
visualize_json(data, output="html", detailed=True)
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Tree Display
|
|
432
|
+
|
|
433
|
+
```python
|
|
434
|
+
from json_explorer.tree_view import print_compact_tree, print_json_analysis
|
|
435
|
+
|
|
436
|
+
# Full analysis with tree
|
|
437
|
+
print_json_analysis(data, source="API Response", show_raw=False)
|
|
438
|
+
|
|
439
|
+
# Compact tree (no annotations)
|
|
440
|
+
print_compact_tree(data, source="Config File")
|
|
441
|
+
|
|
442
|
+
# Custom tree builder
|
|
443
|
+
from json_explorer.tree_view import JsonTreeBuilder
|
|
444
|
+
|
|
445
|
+
builder = JsonTreeBuilder(show_conflicts=True, show_optional=True)
|
|
446
|
+
# ... use builder for custom visualization
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### Code Generation
|
|
450
|
+
|
|
451
|
+
```python
|
|
452
|
+
from json_explorer.codegen import (
|
|
453
|
+
quick_generate,
|
|
454
|
+
generate_from_analysis,
|
|
455
|
+
create_config,
|
|
456
|
+
list_languages,
|
|
457
|
+
get_language_info,
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
# Quick generation
|
|
461
|
+
go_code = quick_generate(data, language="go", package_name="models", root_name="User")
|
|
462
|
+
|
|
463
|
+
python_code = quick_generate(
|
|
464
|
+
data, language="python", style="pydantic", package_name="models"
|
|
465
|
+
)
|
|
466
|
+
|
|
467
|
+
# Detailed workflow
|
|
468
|
+
analysis = analyze_json(data)
|
|
469
|
+
config = create_config(
|
|
470
|
+
language="go",
|
|
471
|
+
package_name="api",
|
|
472
|
+
add_comments=True,
|
|
473
|
+
language_config={"use_pointers_for_optional": True, "int_type": "int64"},
|
|
474
|
+
)
|
|
475
|
+
|
|
476
|
+
result = generate_from_analysis(analysis, "go", config, "User")
|
|
477
|
+
if result.success:
|
|
478
|
+
print(result.code)
|
|
479
|
+
with open("models.go", "w") as f:
|
|
480
|
+
f.write(result.code)
|
|
481
|
+
else:
|
|
482
|
+
print(f"Error: {result.error_message}")
|
|
483
|
+
|
|
484
|
+
# Discover capabilities
|
|
485
|
+
languages = list_languages()
|
|
486
|
+
print(f"Supported: {languages}")
|
|
487
|
+
|
|
488
|
+
info = get_language_info("python")
|
|
489
|
+
print(f"Python styles: {info.get('styles', [])}")
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### Terminal UI from Python
|
|
493
|
+
|
|
494
|
+
```python
|
|
495
|
+
from json_explorer.tui import run_tui
|
|
496
|
+
|
|
497
|
+
exit_code = run_tui(data, source="my_data.json") # until the user quits
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
---
|
|
501
|
+
|
|
502
|
+
## Configuration
|
|
503
|
+
|
|
504
|
+
### Configuration File Format
|
|
505
|
+
|
|
506
|
+
JSON Explorer uses JSON configuration files for code generation:
|
|
507
|
+
|
|
508
|
+
```json
|
|
509
|
+
{
|
|
510
|
+
"package_name": "models",
|
|
511
|
+
"add_comments": true,
|
|
512
|
+
"json_tag_omitempty": true,
|
|
513
|
+
"language_config": {
|
|
514
|
+
"use_pointers_for_optional": true,
|
|
515
|
+
"int_type": "int64",
|
|
516
|
+
"float_type": "float64"
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### Language-Specific Examples
|
|
522
|
+
|
|
523
|
+
#### Go Configuration
|
|
524
|
+
|
|
525
|
+
```json
|
|
526
|
+
{
|
|
527
|
+
"package_name": "api",
|
|
528
|
+
"add_comments": true,
|
|
529
|
+
"json_tag_omitempty": true,
|
|
530
|
+
"language_config": {
|
|
531
|
+
"use_pointers_for_optional": true,
|
|
532
|
+
"int_type": "int64",
|
|
533
|
+
"float_type": "float64"
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
#### Python Dataclass Configuration
|
|
539
|
+
|
|
540
|
+
```json
|
|
541
|
+
{
|
|
542
|
+
"package_name": "models",
|
|
543
|
+
"add_comments": true,
|
|
544
|
+
"language_config": {
|
|
545
|
+
"style": "dataclass",
|
|
546
|
+
"dataclass_slots": true,
|
|
547
|
+
"dataclass_frozen": false,
|
|
548
|
+
"dataclass_kw_only": true
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
#### Python Pydantic Configuration
|
|
554
|
+
|
|
555
|
+
```json
|
|
556
|
+
{
|
|
557
|
+
"package_name": "models",
|
|
558
|
+
"add_comments": true,
|
|
559
|
+
"language_config": {
|
|
560
|
+
"style": "pydantic",
|
|
561
|
+
"pydantic_config_dict": true,
|
|
562
|
+
"pydantic_extra_forbid": false
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
Load configuration:
|
|
568
|
+
|
|
569
|
+
```bash
|
|
570
|
+
json_explorer data.json --generate go --config go_config.json
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
```python
|
|
574
|
+
from json_explorer.codegen import load_config, generate_from_analysis
|
|
575
|
+
|
|
576
|
+
config = load_config("go_config.json")
|
|
577
|
+
result = generate_from_analysis(analysis, "go", config, "User")
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
## Architecture
|
|
583
|
+
|
|
584
|
+
### Project Structure
|
|
585
|
+
|
|
586
|
+
```
|
|
587
|
+
json_explorer/
|
|
588
|
+
├── __init__.py # Public API exports
|
|
589
|
+
├── __main__.py # Entry point for `python -m json_explorer`
|
|
590
|
+
├── main.py # CLI application coordinator
|
|
591
|
+
├── cli.py # CLI command handler
|
|
592
|
+
├── tui.py # Terminal UI (Textual)
|
|
593
|
+
│
|
|
594
|
+
├── analyzer.py # JSON structure analysis
|
|
595
|
+
├── search.py # JMESPath-based search
|
|
596
|
+
├── stats.py # Statistical analysis
|
|
597
|
+
├── tree_view.py # Tree visualization
|
|
598
|
+
├── visualizer.py # Terminal text charts and Plotly HTML report
|
|
599
|
+
├── utils.py # File/URL loading
|
|
600
|
+
├── ui.py # Small terminal output helpers
|
|
601
|
+
├── errors.py # JsonExplorerError base exception
|
|
602
|
+
├── logging_config.py # Logging setup (silent unless configured)
|
|
603
|
+
│
|
|
604
|
+
└── codegen/
|
|
605
|
+
├── __init__.py # Code generation API
|
|
606
|
+
├── registry.py # Generator registry system
|
|
607
|
+
├── cli_integration.py # CLI integration
|
|
608
|
+
│
|
|
609
|
+
├── core/ # Core codegen infrastructure
|
|
610
|
+
│ ├── naming.py # Word splitting and the name plan
|
|
611
|
+
│ ├── config.py # Configuration and option validation
|
|
612
|
+
│ ├── templates.py # Jinja2 rendering
|
|
613
|
+
│ ├── schema.py # Schema built from the analysis
|
|
614
|
+
│ ├── plugin.py # LanguagePlugin / CliOption
|
|
615
|
+
│ └── generator.py # Base generator
|
|
616
|
+
│
|
|
617
|
+
└── languages/ # Language-specific generators
|
|
618
|
+
├── go/
|
|
619
|
+
│ ├── plugin.py # Registration, CLI flags, examples
|
|
620
|
+
│ ├── generator.py
|
|
621
|
+
│ ├── config.py
|
|
622
|
+
│ ├── naming.py
|
|
623
|
+
│ └── templates/ # Jinja2 templates
|
|
624
|
+
│
|
|
625
|
+
├── python/
|
|
626
|
+
│ ├── plugin.py
|
|
627
|
+
│ ├── generator.py
|
|
628
|
+
│ ├── config.py
|
|
629
|
+
│ ├── naming.py
|
|
630
|
+
│ └── templates/ # Jinja2 templates
|
|
631
|
+
│
|
|
632
|
+
├── rust/ # serde structs
|
|
633
|
+
│ ├── plugin.py
|
|
634
|
+
│ ├── generator.py
|
|
635
|
+
│ ├── config.py
|
|
636
|
+
│ ├── naming.py
|
|
637
|
+
│ └── templates/
|
|
638
|
+
│
|
|
639
|
+
└── typescript/ # Interfaces and Zod schemas
|
|
640
|
+
├── plugin.py
|
|
641
|
+
├── generator.py
|
|
642
|
+
├── config.py
|
|
643
|
+
├── naming.py
|
|
644
|
+
└── templates/
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
### Key Design Patterns
|
|
648
|
+
|
|
649
|
+
- **Typed analysis**: `analyze_json()` returns `Node` trees merged by one rule
|
|
650
|
+
- **Name plan**: every type and field is named once before rendering
|
|
651
|
+
- **Language plugins**: each language is one `LanguagePlugin` (generator, flags, examples),
|
|
652
|
+
registered by the registry or an entry point; the terminal UI builds its options from the flags
|
|
653
|
+
|
|
654
|
+
---
|
|
655
|
+
|
|
656
|
+
## Testing
|
|
657
|
+
|
|
658
|
+
Run the test suite:
|
|
659
|
+
|
|
660
|
+
```bash
|
|
661
|
+
pytest
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
Run with coverage:
|
|
665
|
+
|
|
666
|
+
```bash
|
|
667
|
+
pytest --cov=json_explorer --cov-report=html
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
Test categories:
|
|
671
|
+
|
|
672
|
+
- **Core modules**: analyzer, search, stats, tree_view, visualizer
|
|
673
|
+
- **Codegen core**: naming, schema, config, templates, registry/plugins
|
|
674
|
+
- **Generators**: Go and Python (all styles)
|
|
675
|
+
- **Compile and decode tests** (`test_codegen_compiles.py`): generated Python is executed and must be
|
|
676
|
+
ruff-format clean; generated Go must pass `go vet` and `gofmt`; Go and Pydantic must decode the
|
|
677
|
+
source data. Go checks are skipped when Go isn't installed (`JSON_EXPLORER_GO` can point to one)
|
|
678
|
+
- **CLI**: end-to-end runs of `json_explorer` (`test_cli.py`)
|
|
679
|
+
|
|
680
|
+
---
|
|
681
|
+
|
|
682
|
+
## Supported Languages
|
|
683
|
+
|
|
684
|
+
| Language | Status | Features |
|
|
685
|
+
| -------------- | --------------- | -------------------------------------------------------- |
|
|
686
|
+
| **Go** | ✅ Full Support | Structs, JSON tags, pointers, configurable int/float/time types |
|
|
687
|
+
| **Python** | ✅ Full Support | Dataclasses, Pydantic v2, TypedDict, modern type hints |
|
|
688
|
+
| **TypeScript** | ✅ Full Support | Interfaces, Zod 4 schemas, optional/nullable keys, unions |
|
|
689
|
+
| **Rust** | ✅ Full Support | serde structs, `Option<T>`, renames, raw identifiers |
|
|
690
|
+
|
|
691
|
+
Other languages can be added as plugins (see below).
|
|
692
|
+
|
|
693
|
+
---
|
|
694
|
+
|
|
695
|
+
## Documentation
|
|
696
|
+
|
|
697
|
+
- **API Documentation**: [https://ms-32154.github.io/py-json-analyzer/](https://ms-32154.github.io/py-json-analyzer/)
|
|
698
|
+
- **GitHub Repository**: [https://github.com/MS-32154/py-json-analyzer](https://github.com/MS-32154/py-json-analyzer)
|
|
699
|
+
- **Issue Tracker**: [https://github.com/MS-32154/py-json-analyzer/issues](https://github.com/MS-32154/py-json-analyzer/issues)
|
|
700
|
+
|
|
701
|
+
---
|
|
702
|
+
|
|
703
|
+
## Contributing
|
|
704
|
+
|
|
705
|
+
Contributions are welcome! Here's how to get started:
|
|
706
|
+
|
|
707
|
+
1. **Fork** the repository
|
|
708
|
+
2. **Clone** your fork: `git clone https://github.com/YOUR_USERNAME/py-json-analyzer`
|
|
709
|
+
3. **Create** a feature branch: `git checkout -b feature/amazing-feature`
|
|
710
|
+
4. **Make** your changes and add tests
|
|
711
|
+
5. **Run** tests: `pytest`
|
|
712
|
+
6. **Commit**: `git commit -m 'Add amazing feature'`
|
|
713
|
+
7. **Push**: `git push origin feature/amazing-feature`
|
|
714
|
+
8. **Open** a Pull Request
|
|
715
|
+
|
|
716
|
+
### Development Setup
|
|
717
|
+
|
|
718
|
+
```bash
|
|
719
|
+
# Clone and setup
|
|
720
|
+
git clone https://github.com/MS-32154/py-json-analyzer
|
|
721
|
+
cd py-json-analyzer
|
|
722
|
+
uv sync
|
|
723
|
+
|
|
724
|
+
# Run tests
|
|
725
|
+
uv run pytest
|
|
726
|
+
|
|
727
|
+
# Lint and format code
|
|
728
|
+
uv run ruff check --fix json_explorer/ tests/
|
|
729
|
+
uv run ruff format json_explorer/ tests/
|
|
730
|
+
|
|
731
|
+
# Type checking
|
|
732
|
+
uv run mypy json_explorer/
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
### Adding a New Language Generator
|
|
736
|
+
|
|
737
|
+
1. Create a package with a generator extending `CodeGenerator` (set `language_name`,
|
|
738
|
+
`file_extension`, `template_dir`; implement `generate()`) and its Jinja2 templates
|
|
739
|
+
2. Define `PLUGIN = LanguagePlugin(name=..., generator=..., aliases=..., cli_options=..., examples=...)`
|
|
740
|
+
3. Register it: built-in languages are listed in `_BUILTIN_PLUGINS` in
|
|
741
|
+
`json_explorer/codegen/registry.py`; external packages declare an entry point in the
|
|
742
|
+
`json_explorer.languages` group that points to the plugin
|
|
743
|
+
4. Add the language to `tests/test_codegen_compiles.py` so its output is compiled and checked
|
|
744
|
+
|
|
745
|
+
---
|
|
746
|
+
|
|
747
|
+
## Support
|
|
748
|
+
|
|
749
|
+
### Getting Help
|
|
750
|
+
|
|
751
|
+
- **Documentation**: Check the [API docs](https://ms-32154.github.io/py-json-analyzer/)
|
|
752
|
+
- **Examples**: See the examples section above
|
|
753
|
+
- **Issues**: [GitHub Issues](https://github.com/MS-32154/py-json-analyzer/issues)
|
|
754
|
+
|
|
755
|
+
### Reporting Issues
|
|
756
|
+
|
|
757
|
+
When reporting issues, please include:
|
|
758
|
+
|
|
759
|
+
1. **Python version**: `python --version`
|
|
760
|
+
2. **Package version**: `pip show py-json-analyzer`
|
|
761
|
+
3. **Operating system**
|
|
762
|
+
4. **Minimal reproducible example**
|
|
763
|
+
5. **Full error traceback**
|
|
764
|
+
6. **Expected vs actual behavior**
|
|
765
|
+
|
|
766
|
+
### Feature Requests
|
|
767
|
+
|
|
768
|
+
We welcome feature requests! Please open an issue with:
|
|
769
|
+
|
|
770
|
+
- Clear description of the feature
|
|
771
|
+
- Use cases and benefits
|
|
772
|
+
- Example of how it would work
|
|
773
|
+
- Any relevant mockups or examples
|
|
774
|
+
|
|
775
|
+
---
|
|
776
|
+
|
|
777
|
+
## License
|
|
778
|
+
|
|
779
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
780
|
+
|
|
781
|
+
---
|
|
782
|
+
|
|
783
|
+
## Acknowledgments
|
|
784
|
+
|
|
785
|
+
- **JMESPath**: Powerful JSON query language
|
|
786
|
+
- **Rich**: Beautiful terminal formatting
|
|
787
|
+
- **Textual**: Terminal UI framework
|
|
788
|
+
- **Plotly**: Interactive visualizations
|
|
789
|
+
- **Jinja2**: Flexible template engine
|
|
790
|
+
|
|
791
|
+
---
|
|
792
|
+
|
|
793
|
+
## Author
|
|
794
|
+
|
|
795
|
+
**MS-32154**
|
|
796
|
+
|
|
797
|
+
- GitHub: [@MS-32154](https://github.com/MS-32154)
|
|
798
|
+
- Email: msttoffg@gmail.com
|
|
799
|
+
|
|
800
|
+
---
|
|
801
|
+
|
|
802
|
+
**JSON Explorer** – © 2025 MS-32154. All rights reserved.
|