polars.Series.struct.json_encode#

Series.struct.json_encode() Series[source]#

Convert this struct to a string column with json values.

Examples

>>> s = pl.Series("a", [{"a": [1, 2], "b": [45]}, {"a": [9, 1, 3], "b": None}])
>>> s.struct.json_encode()
shape: (2,)
Series: 'a' [str]
[
    "{"a":[1,2],"b":[45]}"
    "{"a":[9,1,3],"b":null}"
]