Ajax-loader-large-white
Introduction to Twitter's API
Parsing a User Object

The response from the verify_credentials.json endpoint contains a JSON-encoded representation of the authenticating user for successful requests. Now you will parse the API response and print out the current user's screen name.

Add code to decode the HTTP response into a Ruby object. To do this:

Instructions

Add a dependency for the json package
Access the HTTP response body
Decode the JSON-encoded response
Make sure to assign the parsed response to the user variable!

?
Stuck? Get a hint! Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more.

Dependencies can be added by adding require '<package>' to the top of the source file.

The response variable will have a property named body which contains the text of the HTTP response.

You can call JSON.parse to decode a JSON-encoded string. This method returns a decoded object.

script.rb