Skip to content

Instantly share code, notes, and snippets.

@keithmorris
Created November 30, 2013 06:33
Show Gist options
  • Save keithmorris/7716052 to your computer and use it in GitHub Desktop.
Save keithmorris/7716052 to your computer and use it in GitHub Desktop.
This is a simple plugin for Jekyll that allows you to output Ruby Data Structures as JSON data. It supports both `json` and `json_pretty` filters. Just drop it into your _plugins/ directory and go to town.
require "rubygems"
require "json"
module JsonFilter
def json(input)
input.to_json
end
def json_pretty(input)
JSON.pretty_generate(input)
end
Liquid::Template.register_filter self
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment