nov / jsonbuilder

Json builder which has the same interface with Builder::XmlMarkup

Home Page:http://rubygems.org/gems/jsonbuilder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

= jsonbuilder

  by nov http://github.com/nov <nov@cerego.com> and
     birkirb http://github.com/birkirb

== Description

== Installation

  git clone http://github.com/nov/jsonbuilder.git
  cd jsonbuilder
  rake install

=== Archive Installation

  rake install

=== Gem Installation

  gem install jsonbuilder --source http://gems.rubyforge.org

     OR for the lastest development version

  gem install nov-jsonbuilder --source http://gems.github.com

== Features/Problems

  The Hash builder will return a hash structured in a similar way as the corresponding xml
  built by XmlMarkup. The Json builder will return the same kind of hash as a JSON string

  USAGE:
  def serialize(builder, options = {})
    builder.user(
      :id => id,
      :url => url
    )
    builder.array_mode do
      builder.images do
        package.images.each do |image|
          builder << image.builder(builder.class.new, :only_url => true)
        end
      end
    end
    builder.target!
  end

  def to_xml(options = {})
    self.serialize(Builder::XMmlMarkup.new, options)
  end

  def to_hash(options = {})
    self.serialize(Builder::HashStructure.new, options)
  end

  def to_json(options = {})
    self.serialize(Builder::JsonFormat.new, options)
  end

== Synopsis

== Copyright

Author::    nov <nov@matake.jp> and birkirb
Copyright:: Copyright (c) 2009 nov
License::   MIT License

About

Json builder which has the same interface with Builder::XmlMarkup

http://rubygems.org/gems/jsonbuilder


Languages

Language:Ruby 100.0%