https://github.com/lmmx/polars-genson
A Polars plugin for JSON schema inference from string columns using genson-rs.
https://github.com/lmmx/polars-genson
genson json-schema polars-dataframe polars-extensions schema-inference
Last synced: about 2 months ago
JSON representation
A Polars plugin for JSON schema inference from string columns using genson-rs.
- Host: GitHub
- URL: https://github.com/lmmx/polars-genson
- Owner: lmmx
- License: mit
- Created: 2025-08-17T22:43:15.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2025-09-06T14:17:15.000Z (about 2 months ago)
- Last Synced: 2025-09-06T16:13:56.340Z (about 2 months ago)
- Topics: genson, json-schema, polars-dataframe, polars-extensions, schema-inference
- Language: Rust
- Homepage: https://polars-genson.vercel.app
- Size: 22 MB
- Stars: 5
- Watchers: 0
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-polars - polars-genson - Fast JSON schema inference with support for Polars DataFrames by [@lmmx](https://github.com/lmmx). (Libraries/Packages/Scripts / Polars plugins)
README
# Polars Genson
[](https://pypi.org/project/polars-genson)
[](https://crates.io/crates/genson-core)
[](https://crates.io/crates/genson-cli)
[](https://crates.io/crates/polars-jsonschema-bridge)
[](https://github.com/lmmx/polars-genson/blob/master/LICENSE)
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/](https://github.com/lmmx/polars-genson/blob/master/polars-genson-py)** - Python bindings and Polars plugin
#### Quick Start
```bash
pip install polars-genson[polars]
```
```python
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/](https://github.com/lmmx/polars-genson/blob/master/genson-core)** - Core JSON schema inference library
- **[polars-jsonschema-bridge/](https://github.com/lmmx/polars-genson/blob/master/polars-jsonschema-bridge)** - JSON Schema ↔ Polars type conversion
- **[genson-cli/](https://github.com/lmmx/polars-genson/blob/master/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](https://github.com/lmmx/polars-genson/blob/master/polars-genson-py/README.md)
- **Rust developers**: See individual crate READMEs
- **Development**: See [DEVELOPMENT.md](https://github.com/lmmx/polars-genson/blob/master/DEVELOPMENT.md)
## License
Licensed under the MIT License. See [LICENSE](https://github.com/lmmx/polars-genson/blob/master/LICENSE) for details.