When I try sudo gem install json I get the following error
If you have this problem:
ERROR: Error installing json:ERROR: Failed to build gem native extension.
and you are using a Mac with OS X (tested with 10.8.1 Mountain Lion), you need to download Xcode from the Mac App Store (or from developer.apple.com if you have a dev account - it's free BTW and you can download a DMG installer)
The latest Xcode versions (I'm using Xcode 4.4.1) does NOT include command line tools. Now you need to install this additional package inside Xcode. Once done, your problem is fixed.
To do that, open Xcode, go to Preferences > Downloads > Components. Install "Command Line Tools". You're done. Now you can install the json Ruby gem.