Unfortunately the version of Ruby that ships with Sketchup does not have support for parsing and creating JSON strings. There is a Ruby Gem available http://flori.github.com/json/ but I could not get this working in the Sketchup environment.
It is pretty straight forward to use.
json = JSON.new;
jsonString = json.marshal(obj); # Where obj is a Ruby object