Method: HTTPX::Response#json

Defined in:
lib/httpx/response.rb

#json(*args) ⇒ Object

decodes the response payload into a ruby object if the payload is valid json.

response.json #≈> { "foo" => "bar" } for "{\"foo\":\"bar\"}" payload
response.json(symbolize_names: true) #≈> { foo: "bar" } for "{\"foo\":\"bar\"}" payload


170
171
172
# File 'lib/httpx/response.rb', line 170

def json(*args)
  decode(Transcoder::JSON, *args)
end