Skip to content

Commit

Permalink
Updated readme for the new load/dump syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
arsduo committed Apr 16, 2012
1 parent 86198e3 commit 5634253
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ fastest available JSON coder. Here's how to use it:

require 'multi_json'

MultiJson.decode('{"abc":"def"}') #=> {"abc" => "def"}
MultiJson.decode('{"abc":"def"}', :symbolize_keys => true) #=> {:abc => "def"}
MultiJson.encode({:abc => 'def'}) # convert Ruby back to JSON
MultiJson.encode({:abc => 'def'}, :pretty => true) # encoded in a pretty form (if supported by the coder)
MultiJson.load('{"abc":"def"}') #=> {"abc" => "def"}
MultiJson.load('{"abc":"def"}', :symbolize_keys => true) #=> {:abc => "def"}
MultiJson.dump({:abc => 'def'}) # convert Ruby back to JSON
MultiJson.dump({:abc => 'def'}, :pretty => true) # encoded in a pretty form (if supported by the coder)

The `engine` setter takes either a symbol or a class (to allow for custom JSON
parsers) that responds to both `.decode` and `.encode` at the class level.
The `use` method, which sets the MultiJson adapter, takes either a symbol or a class (to allow for custom JSON parsers) that responds to both `.load` and `.dump` at the class level.

MultiJSON tries to have intelligent defaulting. That is, if you have any of the
supported engines already loaded, it will utilize them before attempting to
Expand Down

0 comments on commit 5634253

Please sign in to comment.