Releases: MS-32154/py-json-analyzer
Releases · MS-32154/py-json-analyzer
JSON Explorer v0.4.0
JSON Explorer v0.4.0 - Release Summary
Major Release: JMESPath Integration & Enhanced Architecture
Key Highlights
Powerful JMESPath Search Engine
- Replaced custom search with industry-standard [JMESPath](https://jmespath.org/) query language
- Support for complex queries: filtering, projections, functions, and nested access
- Examples:
users[?age > \30`].name,sort_by(users, &age),length(users)` - Query validation and multi-query execution
Enhanced Visualization
- Modern Plotly-based interactive HTML charts
- Multiple output formats: terminal, HTML, or combined
- Detailed mode with 6+ chart types (data types, depth, quality metrics, complexity gauge)
Production-Ready Architecture
- Modular design with clear separation of concerns
- Comprehensive error handling and centralized logging system
Code Generation Improvements
- Bug fix: Code generation from a template
What's New
Core Modules
search.py: Complete rewrite using JMESPath withJsonSearcherclassvisualizer.py: Multi-format visualization (Plotly/curses/ASCII)tree_view.py: Enhanced tree builder with optional/conflict annotationsutils.py: Interactive input helpers with autocompletelogging_config.py: Centralized logging configuration
CLI Enhancements
--searchnow uses JMESPath syntax--show-examplesdisplays query patterns--tree-resultsfor tree-formatted search output- Better error messages and user feedback
API Improvements
# JMESPath search
from json_explorer import JsonSearcher
searcher = JsonSearcher()
result = searcher.search(data, "users[?age > `30`].email")
# Modern visualization
from json_explorer import visualize_json
visualize_json(data, output="html", detailed=True)
# Code generation
from json_explorer.codegen import quick_generate
code = quick_generate(data, "python", style="pydantic")Documentation
Updated Documentation
- Complete API reference with examples
- JMESPath query guide with common patterns
- Configuration best practices
- Enhanced README with quick start guide
Technical Improvements
- Dependencies: Added
jmespath>=1.0.1,prompt-toolkit>=3.0.0 - Type Safety: Better type hints and validation
- Performance: Query compilation support for repeated searches
- Compatibility: Python 3.11+ with full type checking support
Breaking Changes
- Search functionality now requires JMESPath syntax (simpler and more powerful)
- Old search modes (
--search-type key/value/filter) removed in favor of JMESPath - Some configuration options renamed for consistency
Migration Guide
Old Search (v0.3.x)
json_explorer data.json --search "email" --search-type keyNew Search (v0.4.0)
json_explorer data.json --search "users[*].email"Python API
# Old
searcher.search_keys(data, "email", SearchMode.CONTAINS)
# New
searcher.search(data, "users[*].email")Install/Upgrade:
pip install --upgrade py-json-analyzerLinks:
v0.3.0: Python Generator & Smart Type Resolution
Python Generator & Smart Type Resolution
New Features
-
Full Python Code Generator with 3 styles:
- ✅ Dataclasses (with slots, frozen, kw_only)
- ✅ Pydantic v2 models (with Field(), aliases, validation)
- ✅ TypedDict (with NotRequired for Python 3.11+)
-
Smart Type Resolution:
- None + concrete type = optional field (not conflict)
- Proper optional field detection
- Language-specific defaults (Python: snake_case fields)
-
Comprehensive Test Suite: 80+ tests with pytest
Improvements
- Analyzer detects optional fields when None is present
- Go generator never adds pointers to interface{}/any
- Python automatically uses PEP 8 conventions
- Better naming conflict resolution
Bug Fixes
- Fixed type_map serialization with dataclass slots
- Fixed sanitize_name() order for leading digits
- Fixed Pydantic Field() generation logic
- Fixed None value handling in merge_object_summaries()
Breaking Changes
- Minimum Python version: 3.11+ (for NotRequired support)
- Changed naming.sanitize_name() step order
Documentation
- Updated README and API docs
- Added configuration best practices
- Added type conflict resolution examples
New Feature: Generating code from JSON data
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
This release addresses bugs and introduces optimizations.