Created
September 8, 2011 10:07
-
-
Save awendt/1203071 to your computer and use it in GitHub Desktop.
HTTParty: Using native json parser instead of Crack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This was proposed by @ericgj in | |
# https://github.com/jnunemaker/httparty/issues/75#issuecomment-1258914 | |
# using native json parser instead of Crack | |
class JsonParser < HTTParty::Parser | |
def json | |
::JSON.parse(body) | |
end | |
end | |
class MyClient | |
include HTTParty | |
parser JsonParser | |
# ... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment