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::to_ods_workbook;pub use canonical::CanonicalValue;pub use detect::detect_content;pub use detect::detect_extension;pub use filter::Filter;pub use inspect::inspect;pub use ndjson::stream_delimited_to_ndjson;pub use ndjson::stream_ndjson_to_delimited;pub use ndjson::stream_ndjson_to_ndjson;pub use sort::external_sort_delimited;pub use sort::SortSpec;pub use transform::Transforms;
Modules§
- canonical
- detect
- filter
- inspect
- ndjson
- query
- SQL query engine over files.
- sort
- transform
- view
- Table rendering and multi-source loading for
sheeter view. - xlsx_
tools - Excel-specific helpers:
xlsx:mergeandxlsx:frag.
Enums§
- Format
- Supported data formats.
- SqlDialect
- SQL dialect used when parsing input. The writer emits ANSI-compatible
INSERTstatements that SQLite, PostgreSQL, and MySQL all accept.
Functions§
- convert
- Converts
inputfrom one format to another via the canonical hub. - convert_
workbook - Converts a byte buffer between formats, supporting multi-sheet workbooks.
- convert_
workbook_ with_ options - Like
convert_workbook, but lets the caller pick the SQL dialect and the table name used when writing SQL output. - csv_
to_ json - Converts a CSV string into a JSON array of objects.
- csv_
to_ toml - Converts CSV to TOML via the canonical hub.
- 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_ toml - Converts a JSON value to TOML.
- 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.
- stream_
delimited - Converts CSV or TSV input to CSV or TSV output using constant memory.
- toml_
to_ csv - Converts a TOML document to CSV, extracting the first array of tables.
- toml_
to_ json - Converts a TOML document to a JSON value.
- toml_
to_ tsv - Converts a TOML document to TSV.
- toml_
to_ xml - Converts a TOML document to XML.
- toml_
to_ yaml - Converts a TOML document to YAML.
- 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_ toml - Converts TSV to TOML via the canonical hub.
- 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_ toml - Converts XML to TOML via the canonical hub.
- 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_ toml - Converts YAML to TOML via the canonical hub.
- 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.
Type Aliases§
- Output
Doc - One output document:
(sheet_name, bytes). Returned byconvert_workbookbecause multi-sheet inputs can produce more than one output.