Skip to content

Instantly share code, notes, and snippets.

@batasrki
Forked from tenderlove/json_builder.rb
Created November 30, 2011 20:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save batasrki/1410634 to your computer and use it in GitHub Desktop.
###
# This is a JSON building library. It allows you to build data structures
# to dump as JSON. Here is a sample of how to use it:
#
# def person_hash(person)
# {
# 'name' => person.name,
# 'age' => person.age,
# 'friends' => person.friends.map { |x| person_hash x }
# }
# end
#
# JSON.dump person_hash Person.find 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment