pub fn tsv_to_json(tsv: &str) -> Result<String, Box<dyn Error>>Expand description
Converts a TSV string into a JSON array of objects.
TSV (Tab-Separated Values) is the same tabular model as CSV but uses a tab character as the field separator. This is useful for data exported from spreadsheet tools that prefer tabs over commas.
§Errors
Returns an error on malformed TSV, duplicate headers, or JSON failure.
§Examples
use sheeter_engine::tsv_to_json;
let tsv = "name\tage\nAlice\t30";
let json = tsv_to_json(tsv).unwrap();
assert_eq!(json, r#"[{"name":"Alice","age":"30"}]"#);