Polars Genson
August 23, 2025 ยท View on GitHub
Fast JSON schema inference with support for Polars DataFrames.
Project Structure
This workspace contains multiple interconnected crates, most people will probably want the Python package:
Python Package
- polars-genson-py/ - Python bindings and Polars plugin
Quick Start
pip install polars-genson[polars]
import polars as pl
import polars_genson
df = pl.DataFrame({
"json_data": [
'{"name": "Alice", "age": 30, "scores": [95, 87]}',
'{"name": "Bob", "age": 25, "city": "NYC", "active": true}'
]
})
json_schema = df.genson.infer_json_schema("json_data")
polars_schema = df.genson.infer_polars_schema("json_data")
Rust Libraries
- genson-core/ - Core JSON schema inference library
- polars-jsonschema-bridge/ - JSON Schema โ Polars type conversion
- genson-cli/ - Command-line schema inference tool
Features
- Fast schema inference from JSON strings in Polars columns
- Dual output formats: JSON Schema and native Polars schemas
- Complex type support: nested objects, arrays, mixed types
- Multiple JSON formats: single objects, arrays, NDJSON
- Rust performance with Python convenience
Documentation
Each component has detailed documentation:
- Python users: See polars-genson-py/README.md
- Rust developers: See individual crate READMEs
- Development: See DEVELOPMENT.md
License
Licensed under the MIT License. See LICENSE for details.