Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can convert a DataFrame from Polars to serde_json::Value using serialization in the following way:

  1. Serialize the DataFrame to a JSON string.
let df = /* your dataframe */;
let json_str = df.to_json().unwrap();
  1. Deserialize the JSON string to a serde_json::Value.
let json_val: serde_json::Value = serde_json::from_str(&json_str).unwrap();

The json_val variable will hold the deserialized JSON value of the DataFrame.