Class: MultiJson::Adapters::JsonCommon

### Home Classes Methods

### In Files

- lib/multi_json/adapters/json_common.rb

### Parent

MultiJson::Adapter

### Methods

- #dump
- #load

### Class/Module Index

Quicksearch

- MultiJson
- MultiJson::Adapter
- MultiJson::Adapters
- MultiJson::Adapters::Gson
- MultiJson::Adapters::Jrjackson
- MultiJson::Adapters::JsonCommon
- MultiJson::Adapters::JsonGem
- MultiJson::Adapters::JsonPure
- MultiJson::Adapters::Nsjsonserialization
- MultiJson::Adapters::Oj
- MultiJson::Adapters::OkJson
- MultiJson::Adapters::Yajl
- MultiJson::ConvertibleHashKeys
- MultiJson::LoadError
- MultiJson::OkJson
- MultiJson::OkJson::Error
- MultiJson::OkJson::Utf8Error
- MultiJson::Options

No matching classes.

# MultiJson::Adapters::JsonCommon

### Public Instance Methods

dump(object, options={}) click to toggle source

    # File lib/multi_json/adapters/json_common.rb, line 19
    def dump(object, options={})
      options.merge!(::JSON::PRETTY_STATE_PROTOTYPE.to_h) if options.delete(:pretty)
      object.to_json(options)
    end

load(string, options={}) click to toggle source

    # File lib/multi_json/adapters/json_common.rb, line 8
    def load(string, options={})
      string = string.read if string.respond_to?(:read)

      if string.respond_to?(:force_encoding)
        string = string.dup.force_encoding(::Encoding::ASCII_8BIT)
      end

      options[:symbolize_names] = true if options.delete(:symbolize_keys)
      ::JSON.parse(string, options)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.