{"id":25492404,"url":"https://github.com/peeeuzin/jsonbuilder","last_synced_at":"2026-05-03T15:34:24.313Z","repository":{"id":250382176,"uuid":"834306787","full_name":"peeeuzin/jsonbuilder","owner":"peeeuzin","description":"Json builder is used to create JSON structures using a simple DSL for Rust.","archived":false,"fork":false,"pushed_at":"2024-07-26T23:11:39.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-02T13:13:34.851Z","etag":null,"topics":["builder","dsl","jbuilder","json","json-builder","rust"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/jsonbuilder","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/peeeuzin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2024-07-26T22:39:36.000Z","updated_at":"2024-07-26T23:17:48.000Z","dependencies_parsed_at":"2024-07-27T00:26:23.219Z","dependency_job_id":"80a4a9ba-e6b2-4c73-8b09-cee427c42726","html_url":"https://github.com/peeeuzin/jsonbuilder","commit_stats":null,"previous_names":["peeeuzin/jsonbuilder"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/peeeuzin/jsonbuilder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peeeuzin%2Fjsonbuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peeeuzin%2Fjsonbuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peeeuzin%2Fjsonbuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peeeuzin%2Fjsonbuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peeeuzin","download_url":"https://codeload.github.com/peeeuzin/jsonbuilder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peeeuzin%2Fjsonbuilder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32575111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["builder","dsl","jbuilder","json","json-builder","rust"],"created_at":"2025-02-18T22:29:40.792Z","updated_at":"2026-05-03T15:34:24.270Z","avatar_url":"https://github.com/peeeuzin.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Json builder\nA json builder used to create JSON structures using a simple DSL (based on [Jbuilder](https://github.com/rails/jbuilder)). It is a simple and easy to use tool to create JSON structures in Rust.\n\n## Example\n```jb\nnotes @notes |note| do\n    content @note.content\n    author do\n        name @note.author.name\n        age @note.author.age\n    end\n    comments @note.comments |comment| do\n        content @comment.content\n        author do\n            name @comment.author.name\n            age @comment.author.age\n        end\n    end\nend\n```\n\nBuilt with the above DSL, the following JSON structure will be created:\n```json\n{\n    \"notes\": [\n        {\n            \"content\": \"Note content\",\n            \"author\": {\n                \"name\": \"Author name\",\n                \"age\": 20\n            },\n            \"comments\": [\n                {\n                    \"content\": \"Comment content\",\n                    \"author\": {\n                        \"name\": \"Comment author name\",\n                        \"age\": 25\n                    }\n                }\n            ]\n        }\n    ]\n}\n```\n\n# Installation\nAdd the following to your `Cargo.toml` file:\n```toml\n[dependencies]\njsonbuilder = \"0.1.0\"\n```\n\n# Usage\n```rust\nuse jsonbuilder::{JsonBuilder, context_map};\n\n#[derive(Serialize)]\nstruct Note {\n    content: String,\n}\n\nfn main() {\n    let context = context_map!({\n        \"note\" =\u003e Note::new(),\n    })\n\n    let json = JsonBuilder::render(\"data\", context)\n}\n```\nJsonBuilder searches for a file that ends with `json.jb` in `templates` directory.\n\nor you can render with raw string:\n```rust\nuse jsonbuilder::JsonBuilder;\n\n#[derive(Serialize)]\nstruct Note {\n    content: String,\n}\n\nfn main() {\n    let context = context_map!({\n        \"note\" =\u003e Note::new(),\n    })\n\n    let input = \"\n    note @note.content\n\n    ...\n    \"\n    let json = JsonBuilder::render_raw(input, context)\n}\n```\n\n# Settings\nyou can change the settings by creating a `jsonbuilder.toml` file in the root of your project.\n```toml\ntemplate_path = \"another/path/to/templates\"\n```\n\n# Syntax\nThe syntax is based on [Jbuilder](https://github.com/rails/jbuilder) and is very similar to it. The following is a list of the supported syntax:\n\n## Variables\n```jb\nname @variable\n```\n\n## Array mapping\n```jb\nnames @names |item| do\n    name @item\nend\n```\n\n## Object mapping\n```jb\nperson do\n    name @person.name\n    age @person.age\n    _ @person.abilities # _ is a special character that allows you to access the entire object\nend\n```\n\n# Roadmap\n- [x] Basic DSL\n- [x] Array mapping\n- [x] Object mapping\n- [ ] Extend with another templates\n- [ ] Conditional statements\n- [ ] Merge objects\n\n# Contributing\nContributions are welcome! Feel free to open an issue or submit a pull request.\n\nSee the [contribution guidelines](CONTRIBUTING.md) for more information.\n\n# License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeeeuzin%2Fjsonbuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeeeuzin%2Fjsonbuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeeeuzin%2Fjsonbuilder/lists"}