andi/simple-navigation — pull request #130 by albertein (2013-06-04 15:48:29+00:00)
Title: Added json renderer, Issue #129

The json renderer outputs a json string representing the full menu. This renderer can be useful when implementing a custom javascript menu.

The top level object is an array containing the top level menu items, every menu item has the name, url, selected and items keys. The items properties contains either the array of the sub menu items or null where it is a leaf node.

You can invoke the renderer on the following way:

```ruby
render_navigation(:renderer => :json)
```
Most of the time you'll want the menu to be assigned directly on javascript, on those cases you'll problably would want to avoid the output to be escaped:
```ruby
<%= raw render_navigation(:renderer => :json) %>
```
You can also use this renderer to get the menu as a ruby Hash, to do so you need to set the option ```:as_hash``` to true:
```ruby
render_navigation(:renderer => :json, :as_hash => true)
```
Please be aware that even when requesting the output as a hash the results is actually an array where every item is a hash object.