nushell/crates/nu_plugin_polars
Jack Wright ff8831318d
Added polars struct-encode-json, providing the ability to encode structs as json (#15678)
# Description
This PR introduces `polars struct-encode-json`. This exposes the ability
to encode struct columns as json strings. This is useful when converting
things to formats like CSV that do not support complex types.

```nushell
> ❯ : [[id person]; [1 {name: "Bob", age: 36}] [2 {name: "Betty", age: 63}]]
                    | polars into-df -s {id: i64, person: {name: str, age: u8}}
                    | polars select id (polars col person | polars struct-json-encode | polars as encoded) 
                    | polars collect
╭───┬────┬───────────────────────────╮
│ # │ id │          encoded          │
├───┼────┼───────────────────────────┤
│ 0 │  1 │ {"age":36,"name":"Bob"}   │
│ 1 │  2 │ {"age":63,"name":"Betty"} │
╰───┴────┴───────────────────────────╯
```

# User-Facing Changes
* Added `polars struct-encode-json`, providing the ability to encode
structs as json
2025-05-06 13:58:51 -07:00
..
src Added polars struct-encode-json, providing the ability to encode structs as json (#15678) 2025-05-06 13:58:51 -07:00
Cargo.toml Bump to 0.104.1 dev version (#15669) 2025-04-29 23:33:10 -04:00
LICENSE Move dataframes support to a plugin (#12220) 2024-04-09 19:31:43 -05:00