{"id":15994685,"url":"https://github.com/taiki-e/syn-serde","last_synced_at":"2025-10-03T13:52:59.374Z","repository":{"id":35116111,"uuid":"174708076","full_name":"taiki-e/syn-serde","owner":"taiki-e","description":"Library to serialize and deserialize Syn syntax trees.","archived":false,"fork":false,"pushed_at":"2024-10-25T13:56:49.000Z","size":5064,"stargazers_count":24,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-25T17:58:14.402Z","etag":null,"topics":["proc-macro","rust","serde"],"latest_commit_sha":null,"homepage":"https://docs.rs/syn-serde","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taiki-e.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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},"funding":{"github":"taiki-e"}},"created_at":"2019-03-09T15:01:29.000Z","updated_at":"2024-10-25T13:56:53.000Z","dependencies_parsed_at":"2023-09-27T08:35:34.816Z","dependency_job_id":"65bddf91-b4d1-4192-8651-9aeca69908be","html_url":"https://github.com/taiki-e/syn-serde","commit_stats":{"total_commits":1933,"total_committers":54,"mean_commits":35.7962962962963,"dds":"0.29229177444386967","last_synced_commit":"e9d678624255561d82b6b01822630e7376e2c0e9"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fsyn-serde","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fsyn-serde/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fsyn-serde/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fsyn-serde/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taiki-e","download_url":"https://codeload.github.com/taiki-e/syn-serde/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247441063,"owners_count":20939239,"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":["proc-macro","rust","serde"],"created_at":"2024-10-08T07:09:49.356Z","updated_at":"2025-10-03T13:52:59.367Z","avatar_url":"https://github.com/taiki-e.png","language":"Rust","readme":"# syn-serde\n\n[![crates.io](https://img.shields.io/crates/v/syn-serde?style=flat-square\u0026logo=rust)](https://crates.io/crates/syn-serde)\n[![docs.rs](https://img.shields.io/badge/docs.rs-syn--serde-blue?style=flat-square\u0026logo=docs.rs)](https://docs.rs/syn-serde)\n[![license](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue?style=flat-square)](#license)\n[![msrv](https://img.shields.io/badge/msrv-1.61-blue?style=flat-square\u0026logo=rust)](https://www.rust-lang.org)\n[![github actions](https://img.shields.io/github/actions/workflow/status/taiki-e/syn-serde/ci.yml?branch=main\u0026style=flat-square\u0026logo=github)](https://github.com/taiki-e/syn-serde/actions)\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:start:src/lib.rs --\u003e\n\nLibrary to serialize and deserialize [Syn] syntax trees.\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nsyn-serde = \"0.3\"\n```\n\n## Examples\n\n```toml\n[dependencies]\nsyn-serde = { version = \"0.3\", features = [\"json\"] }\nsyn = { version = \"2\", features = [\"full\"] }\n```\n\n```rust\nuse syn_serde::json;\n\nlet syn_file: syn::File = syn::parse_quote! {\n    fn main() {\n        println!(\"Hello, world!\");\n    }\n};\n\nprintln!(\"{}\", json::to_string_pretty(\u0026syn_file));\n```\n\nThis prints the following JSON:\n\n```json\n{\n  \"items\": [\n    {\n      \"fn\": {\n        \"ident\": \"main\",\n        \"inputs\": [],\n        \"output\": null,\n        \"stmts\": [\n          {\n            \"semi\": {\n              \"macro\": {\n                \"path\": {\n                  \"segments\": [\n                    {\n                      \"ident\": \"println\"\n                    }\n                  ]\n                },\n                \"delimiter\": \"paren\",\n                \"tokens\": [\n                  {\n                    \"lit\": \"\\\"Hello, world!\\\"\"\n                  }\n                ]\n              }\n            }\n          }\n        ]\n      }\n    }\n  ]\n}\n```\n\n### Rust source file -\u003e JSON representation of the syntax tree\n\nThe [`rust2json`] example parse a Rust source file into a `syn_serde::File`\nand print out a JSON representation of the syntax tree.\n\n### JSON file -\u003e Rust syntax tree\n\nThe [`json2rust`] example parse a JSON file into a `syn_serde::File` and\nprint out a Rust syntax tree.\n\n## Optional features\n\n- **`json`** — Provides functions for JSON \u003c-\u003e Rust serializing and\n  deserializing.\n\n## Relationship to Syn\n\nsyn-serde is a fork of [Syn], and syn-serde provides a set of data structures\nsimilar but not identical to [Syn]. All data structures provided by syn-serde\ncan be converted to the data structures of [Syn] and [proc-macro2].\n\nThe data structures of syn-serde 0.3 is compatible with the data structures of\n[Syn] 2.x.\n\n[Syn]: https://github.com/dtolnay/syn\n[proc-macro2]: https://github.com/alexcrichton/proc-macro2\n[`rust2json`]: https://github.com/taiki-e/syn-serde/tree/HEAD/examples/rust2json\n[`json2rust`]: https://github.com/taiki-e/syn-serde/tree/HEAD/examples/json2rust\n\n\u003c!-- tidy:sync-markdown-to-rustdoc:end --\u003e\n\n## License\n\nLicensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or\n[MIT license](LICENSE-MIT) at your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n","funding_links":["https://github.com/sponsors/taiki-e"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fsyn-serde","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaiki-e%2Fsyn-serde","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fsyn-serde/lists"}