{"id":18941988,"url":"https://github.com/lucidfrontier45/serdeio","last_synced_at":"2026-01-28T01:05:46.426Z","repository":{"id":196983861,"uuid":"697753654","full_name":"lucidfrontier45/serdeio","owner":"lucidfrontier45","description":"Tiny IO utility library for Rust to serialize/deserialize Serde compatible structs","archived":false,"fork":false,"pushed_at":"2024-07-01T00:35:30.000Z","size":28,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-02-10T16:06:37.176Z","etag":null,"topics":["file-io","file-reading","file-writing","input-output","io","rust","serde","serialization"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/serdeio","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucidfrontier45.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-28T12:07:59.000Z","updated_at":"2024-07-01T00:35:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"1fb35066-42b1-43c1-a651-0ad8919081c5","html_url":"https://github.com/lucidfrontier45/serdeio","commit_stats":null,"previous_names":["lucidfrontier45/recordio","lucidfrontier45/serdeio"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidfrontier45%2Fserdeio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidfrontier45%2Fserdeio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidfrontier45%2Fserdeio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucidfrontier45%2Fserdeio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucidfrontier45","download_url":"https://codeload.github.com/lucidfrontier45/serdeio/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240767695,"owners_count":19854305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-io","file-reading","file-writing","input-output","io","rust","serde","serialization"],"created_at":"2024-11-08T12:30:40.653Z","updated_at":"2026-01-28T01:05:41.389Z","avatar_url":"https://github.com/lucidfrontier45.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SerdeIO\nTiny IO utility library for Rust to serialize/deserialize Serde compatible structs\n\n# Install\n\n```sh\ncargo add serdeio\n```\n\nSerdeIO supports JSON and JSON Lines formats. Additional formats are supported by enabling corresponding features.\n\n- `yaml`\n- `csv`\n\n# How to use\n\n- `read_record_from_reader` is used to read a deserializable type `T` from `std::io::Read`. Data format must be specified by `DataFormat` enum.\n- `read_records_from_reader` always tries to deserialize the data as `Vec\u003cT\u003e`.\n- `read_record_from_file` accepts an `AsRef\u003cPath\u003e`. Data format is automatically determined by file extension.\n- `write_*` functions follow the same rules as `read_*`.\n\nNote that some data format like CSV and JSON Lines support only reading records `Vec\u003cT\u003e`.\n\n# Examples\n\nThe following code read a JSON file and parse it as `Vec\u003cUser\u003e`. Then it encodes the data into YAML format and write it to STDOUT.\n\n```rust\nuse anyhow::{anyhow, Context, Result as AnyResult};\nuse serde::{Deserialize, Serialize};\nuse serdeio::{read_record_from_file, write_records_to_writer, DataFormat};\n\n#[derive(Debug, Deserialize, Serialize)]\nstruct User {\n    id: u32,\n    name: String,\n    items: Vec\u003cString\u003e,\n}\n\npub fn main() -\u003e AnyResult\u003c()\u003e {\n    // get input file path from argv\n    let args: Vec\u003cString\u003e = std::env::args().collect();\n    let input_file_path = \u0026args[1];\n\n    // read json file to memory\n    let users: Vec\u003cUser\u003e = read_record_from_file(input_file_path)\n        .context(\"Failed to read records from file\")?;\n\n    // write to stdout in json lines format\n    let writer = std::io::stdout();\n    write_records_to_writer(writer, DataFormat::JsonLines, \u0026users).unwrap();\n\n    Ok(())\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidfrontier45%2Fserdeio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucidfrontier45%2Fserdeio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucidfrontier45%2Fserdeio/lists"}