### Home Classes Methods

### In Files

- lib/yajl/json_gem/encoding.rb
- lib/yajl/json_gem/parsing.rb

### Namespace

- CLASS JSON::GeneratorError
- CLASS JSON::JSONError
- CLASS JSON::ParserError

### Methods

- ::default_options
- ::dump
- ::generate
- ::load
- ::parse
- ::pretty_generate

### Class Index

Quicksearch

- Yajl
- Yajl::Bzip2
- Yajl::Bzip2::StreamReader
- Yajl::Bzip2::StreamWriter
- Yajl::Deflate
- Yajl::Deflate::StreamReader
- Yajl::Deflate::StreamWriter
- Yajl::Encoder
- Yajl::Gzip
- Yajl::Gzip::StreamReader
- Yajl::Gzip::StreamWriter
- Yajl::HttpStream
- Yajl::HttpStream::HttpError
- Yajl::HttpStream::InvalidContentType
- Yajl::Parser
- JSON
- JSON::GeneratorError
- JSON::JSONError
- JSON::ParserError
- Kernel
- Object

No matching classes.

# JSON

### Public Class Methods

default_options() click to toggle source

       # File lib/yajl/json_gem/parsing.rb, line 7
    7:   def self.default_options
    8:     @default_options ||= {:symbolize_keys => false}
    9:   end

dump(obj, io=nil, *args) click to toggle source

        # File lib/yajl/json_gem/encoding.rb, line 44
    44:   def self.dump(obj, io=nil, *args)
    45:     begin
    46:       Yajl::Encoder.encode(obj, io)
    47:     rescue Yajl::EncodeError => e
    48:       raise JSON::GeneratorError, e.message
    49:     end
    50:   end

generate(obj, opts={}) click to toggle source

        # File lib/yajl/json_gem/encoding.rb, line 20
    20:   def self.generate(obj, opts={})
    21:     begin
    22:       options_map = {}
    23:       if opts.has_key?(:indent)
    24:         options_map[:pretty] = true
    25:         options_map[:indent] = opts[:indent]
    26:       end
    27:       Yajl::Encoder.encode(obj, options_map)
    28:     rescue Yajl::EncodeError => e
    29:       raise JSON::GeneratorError, e.message
    30:     end
    31:   end

load(input, *args) click to toggle source

        # File lib/yajl/json_gem/parsing.rb, line 19
    19:   def self.load(input, *args)
    20:     begin
    21:       Yajl::Parser.parse(input, default_options)
    22:     rescue Yajl::ParseError => e
    23:       raise JSON::ParserError, e.message
    24:     end
    25:   end

parse(str, opts=JSON.default_options) click to toggle source

        # File lib/yajl/json_gem/parsing.rb, line 11
    11:   def self.parse(str, opts=JSON.default_options)
    12:     begin
    13:       Yajl::Parser.parse(str, opts)
    14:     rescue Yajl::ParseError => e
    15:       raise JSON::ParserError, e.message
    16:     end
    17:   end

pretty_generate(obj, opts={}) click to toggle source

        # File lib/yajl/json_gem/encoding.rb, line 33
    33:   def self.pretty_generate(obj, opts={})
    34:     begin
    35:       options_map = {}
    36:       options_map[:pretty] = true
    37:       options_map[:indent] = opts[:indent] if opts.has_key?(:indent)
    38:       Yajl::Encoder.encode(obj, options_map)
    39:     rescue Yajl::EncodeError => e
    40:       raise JSON::GeneratorError, e.message
    41:     end
    42:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.