diff --git a/README.md b/README.md index 8c913c5d..bd21a9b5 100644 --- a/README.md +++ b/README.md @@ -256,37 +256,34 @@ end If you would like to add meta information to the outputted JSON, use the `:meta` option: -``` -render :json => @posts, :serializer => CustomArraySerializer, -:meta => {:total => 10} +```ruby +render :json => @posts, :serializer => CustomArraySerializer, :meta => {:total => 10} ``` The above usage of `:meta` will produce the following: -``` +```json { - meta: { total: 10 - }, - posts: [ + "meta": { "total": 10 }, + "posts": [ { "title": "Post 1", "body": "Hello!" }, { "title": "Post 2", "body": "Goodbye!" } ] } ``` -If you would like to to change the attribute name you can use the `meta_key` option: +If you would like to change the meta key name you can use the `meta_key` option: -``` +```ruby render :json => @posts, :serializer => CustomArraySerializer, :meta => {:total => 10}, :meta_key => 'meta_object' ``` The above usage of `:meta_key` will produce the following: -``` +```json { - meta_object: { total: 10 - }, - posts: [ + "meta_object": { "total": 10 }, + "posts": [ { "title": "Post 1", "body": "Hello!" }, { "title": "Post 2", "body": "Goodbye!" } ]