flatten_json_for_csv

Function flatten_json_for_csv 

Source
pub fn flatten_json_for_csv(value: &Value) -> (Vec<String>, Vec<Vec<String>>)
Expand description

Flattens a JSON Value into a list of records for CSV export.

Returns a tuple of (headers, rows), where rows are vectors of strings corresponding to headers.

  • If value is an Array, each element becomes a row.
  • If value is an Object, it becomes a single row.
  • Nested objects are flattened with dot notation.
  • Arrays inside objects are serialized as JSON strings.