Skip to content

Commit

Permalink
Add explaination of key_format to the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bigjason committed Apr 23, 2012
1 parent 3dfdfcd commit 77b4e15
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Expand Up @@ -90,10 +90,25 @@ end
json.partial! "api/comments/comments", comments: @message.comments
```

Keys can be auto formatted using `key_format!`, this can be used to convert keynames from the standard ruby_format to CamelCase:

``` ruby
json.set_format! :camelize => :lower
json.first_name "David"

# { "firstName": "David" }
```

You can set this globaly with the class method `key_format` (from inside your enviorment.rb for example):

``` ruby
Jbuilder.set_format :camelize => :lower
```

Libraries similar to this in some form or another include:

* RABL: https://github.com/nesquena/rabl
* JsonBuilder: https://github.com/nov/jsonbuilder
* JSON Builder: https://github.com/dewski/json_builder
* Jsonify: https://github.com/bsiggelkow/jsonify
* RepresentationView: https://github.com/mdub/representative_view
* RepresentationView: https://github.com/mdub/representative_view

0 comments on commit 77b4e15

Please sign in to comment.