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.
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.
tsv_to_json
Converts a TSV string into a JSON array of objects.