jbuilder
Version, currently 0.3.04 versions
- 1.0.0latestMar 28, 2021
- 0.3.0not indexedJan 14, 2025
- 0.2.0not indexedJan 14, 2025
- 0.1.0not indexedJan 14, 2025
github.com/shootingfly/jbuilder
Generate JSON objects with a Builder-style DSL, inspired by jbuilder
Nothing has been indexed for 0.3.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
jbuilder:
github: shootingfly/jbuilder
version: ~> 0.3.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.3.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
Documentation
Generated from the source of the current release. The first visit to a release that has never been documented starts its build.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# Jbuilder
[](https://travis-ci.org/shootingfly/jbuilder)[](https://github.com/shootingfly/jbuilder/releases)
Generate JSON objects with a Builder-style DSL, inspired by jbuilder (<https://github.com/rails/jbuilder>)
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
jbuilder:
github: shootingfly/jbuilder
```
2. Run `shards install`
## Usage
```crystal
require "jbuilder"
```
First, write down the code.
```crystal
Jbuilder.new do |json|
json.null nil
json.code 200
json.msg "ok"
json.merge!({"code" => 201})
json.array! "array1", [1, 1.0, "1"]
json.array!("array2", [1, 2, 3, 4]) do |json, item|
json.code item
end
json.data do |json|
json.code 400
json.array! "array3", [1, 1.0, "1"]
end
json.set!("custom_field", %w[1 2])
end.to_json
```
Then you can see,
```json
{
"null":null,
"code":201,
"msg":"ok",
"array1":[
1,
1.0,
"1"
],
"array2":[
{
"code":1
},
{
"code":2
},
{
"code":3
},
{
"code":4
}
],
"data":{
"code":400,
"array3":[
1,
1.0,
"1"
]
},
"custom_field":[
"1",
"2"
]
}
```
## An example using Kemal
https://github.com/shootingfly/kemal-jbuilder-example
## Changelog
+ **v1.0.0**
+ Support Crystal 1.0.0
+ **v0.3.0**
+ Support Tuple and Named Tuple
+ Support render with layout and child template
+ **v0.2.0**
+ Support Kilt
+ **v0.1.0**
+ First Release
## Contributing
1. Fork it (<https://github.com/shootingfly/jbuilder/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request
## Contributors
- [Shooting Fly](https://github.com/shootingfly) - creator and maintainer
Links
This release
- Version
0.3.0- Tagged
- Jan 14, 2025
- Commit
2804704c2aa2- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/shootingfly/jbuilder
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 12, 2026
- Synced
- Aug 12, 2026
- Versions
- 4