Expand description
Sheeter is a data file conversion library and CLI tool.
This crate provides functions to convert between CSV and JSON formats. It is designed to be small, fast, and portable, suitable for use on low-end devices such as Android phones. The core idea is simple: take data in one format, understand its structure, and emit it in another format without unnecessary overhead.
§Examples
Convert CSV to JSON:
use sheeter_engine::csv_to_json;
let csv = "name,age\nAlice,30\nBob,25";
let json = csv_to_json(csv).unwrap();
assert_eq!(json, r#"[{"name":"Alice","age":"30"},{"name":"Bob","age":"25"}]"#);Convert JSON to CSV:
use sheeter_engine::json_to_csv;
let json = r#"[{"name":"Alice","age":"30"},{"name":"Bob","age":"25"}]"#;
let csv = json_to_csv(json).unwrap();
assert_eq!(csv, "name,age\nAlice,30\nBob,25\n");Re-exports§
pub use canonical::CanonicalValue;
Modules§
Functions§
- csv_
to_ json - Converts a CSV string into a JSON array of objects.
- csv_
to_ tsv - Converts CSV to TSV by composing
csv_to_jsonandjson_to_tsv. - csv_
to_ xml - Converts CSV to XML via the canonical hub.
- csv_
to_ yaml - Converts CSV to YAML by composing
csv_to_jsonandjson_to_yaml. - json_
to_ csv - Converts a JSON array of objects into a CSV string.
- json_
to_ tsv - Converts a JSON array of objects into a TSV string.
- json_
to_ xml - Converts a JSON value to XML.
- json_
to_ yaml - Converts a JSON array of objects into a YAML sequence of mappings.
- tsv_
to_ csv - Converts TSV to CSV by composing
tsv_to_jsonandjson_to_csv. - tsv_
to_ json - Converts a TSV string into a JSON array of objects.
- tsv_
to_ xml - Converts TSV to XML via the canonical hub.
- tsv_
to_ yaml - Converts TSV to YAML by composing
tsv_to_jsonandjson_to_yaml. - xml_
to_ csv - Converts XML to CSV, extracting the tabular array if present.
- xml_
to_ json - Converts an XML document to a JSON representation.
- xml_
to_ tsv - Converts XML to TSV, extracting the tabular array if present.
- xml_
to_ yaml - Converts XML to YAML, extracting the tabular array if present.
- yaml_
to_ csv - Converts YAML to CSV by composing
yaml_to_jsonandjson_to_csv. - yaml_
to_ json - Converts a YAML sequence of mappings into a JSON array of objects.
- yaml_
to_ tsv - Converts YAML to TSV by composing
yaml_to_jsonandjson_to_tsv. - yaml_
to_ xml - Converts YAML to XML via the canonical hub.