1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

Update README.md (#646)

This commit is contained in:
Clément Prod'homme 2019-02-18 15:36:03 +01:00 committed by Nikita Misharin
parent 290aa62c33
commit 011c1ac3e3

View file

@ -9,7 +9,7 @@ Makes http fun again!
## Parsing JSON ## Parsing JSON
If the response Content Type is `application/json`, HTTParty will parse the response and return Ruby objects such as a hash or array. The default behavior for parsing JSON will return keys as strings. This can be supressed with the `format` option. To get hash keys as symbols: If the response Content Type is `application/json`, HTTParty will parse the response and return Ruby objects such as a hash or array. The default behavior for parsing JSON will return keys as strings. This can be supressed with the `format` option. To get hash keys as symbols:
``` ```ruby
response = HTTParty.get('http://example.com', format: :plain) response = HTTParty.get('http://example.com', format: :plain)
JSON.parse response, symbolize_names: true JSON.parse response, symbolize_names: true
``` ```