Skip to main content

Crate sheeter_engine

Crate sheeter_engine 

Source
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");

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_json and json_to_tsv.
csv_to_yaml
Converts CSV to YAML by composing csv_to_json and json_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_yaml
Converts a JSON array of objects into a YAML sequence of mappings.
tsv_to_csv
Converts TSV to CSV by composing tsv_to_json and json_to_csv.
tsv_to_json
Converts a TSV string into a JSON array of objects.
tsv_to_yaml
Converts TSV to YAML by composing tsv_to_json and json_to_yaml.
yaml_to_csv
Converts YAML to CSV by composing yaml_to_json and json_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_json and json_to_tsv.