{"id":13483869,"url":"https://github.com/shootingfly/jbuilder","last_synced_at":"2025-10-28T09:39:18.682Z","repository":{"id":194708694,"uuid":"203018048","full_name":"shootingfly/jbuilder","owner":"shootingfly","description":"Generate JSON objects with a Builder-style DSL, inspired by jbuilder","archived":false,"fork":false,"pushed_at":"2025-01-14T06:26:30.000Z","size":30,"stargazers_count":44,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T14:21:44.253Z","etag":null,"topics":["crystal-lang","framework","jbuilder","json","kilt","template-engine"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/shootingfly.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}},"created_at":"2019-08-18T14:45:25.000Z","updated_at":"2025-01-14T06:26:33.000Z","dependencies_parsed_at":"2023-09-14T20:25:39.350Z","dependency_job_id":null,"html_url":"https://github.com/shootingfly/jbuilder","commit_stats":null,"previous_names":["shootingfly/jbuilder"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shootingfly%2Fjbuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shootingfly%2Fjbuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shootingfly%2Fjbuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shootingfly%2Fjbuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shootingfly","download_url":"https://codeload.github.com/shootingfly/jbuilder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252961810,"owners_count":21832189,"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":["crystal-lang","framework","jbuilder","json","kilt","template-engine"],"created_at":"2024-07-31T17:01:16.267Z","updated_at":"2025-10-28T09:39:13.624Z","avatar_url":"https://github.com/shootingfly.png","language":"Crystal","funding_links":[],"categories":["Template Engine"],"sub_categories":[],"readme":"# Jbuilder\n[![Crystal CI](https://github.com/shootingfly/jbuilder/actions/workflows/crystal.yml/badge.svg)](https://github.com/shootingfly/jbuilder/actions/workflows/crystal.yml)\n[![GitHub release](https://img.shields.io/github/release/shootingfly/jbuilder.svg)](https://github.com/shootingfly/jbuilder/releases)\n\nGenerate JSON objects with a Builder-style DSL, inspired by jbuilder (\u003chttps://github.com/rails/jbuilder\u003e)\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     jbuilder:\n       github: shootingfly/jbuilder\n   ```\n\n2. Run `shards install`\n\n## Usage\n\n```crystal\nrequire \"jbuilder\"\n```\n\nFirst, write down the code.\n```crystal\nJbuilder.new do |json|\n  json.null nil\n  json.code 200\n  json.msg \"ok\"\n  json.merge!({\"code\" =\u003e 201})\n  json.array! \"array1\", [1, 1.0, \"1\"]\n  json.array!(\"array2\", [1, 2, 3, 4]) do |json, item|\n    json.code item\n  end\n  json.data do |json|\n    json.code 400\n    json.array! \"array3\", [1, 1.0, \"1\"]\n  end\n  json.set!(\"custom_field\", %w[1 2])\nend.to_json\n```\n\nThen you can see, \n```json\n{\n  \"null\":null,\n  \"code\":201,\n  \"msg\":\"ok\",\n  \"array1\":[\n    1,\n    1.0,\n    \"1\"\n  ],\n  \"array2\":[\n    {\n      \"code\":1\n    },\n    {\n      \"code\":2\n    },\n    {\n      \"code\":3\n    },\n    {\n      \"code\":4\n    }\n  ],\n  \"data\":{\n    \"code\":400,\n    \"array3\":[\n      1,\n      1.0,\n      \"1\"\n    ]\n  },\n  \"custom_field\":[\n    \"1\",\n    \"2\"\n  ]\n}\n```\n\n## An example using Kemal\nhttps://github.com/shootingfly/kemal-jbuilder-example\n\n## Changelog\n+ **v1.0.0**\n  + Support Crystal 1.0.0\n+ **v0.3.0**\n  + Support Tuple and Named Tuple\n  + Support render with layout and child template\n+ **v0.2.0**\n  + Support Kilt\n+ **v0.1.0**\n  + First Release\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/shootingfly/jbuilder/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Shooting Fly](https://github.com/shootingfly) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshootingfly%2Fjbuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshootingfly%2Fjbuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshootingfly%2Fjbuilder/lists"}