Move all to_json/as_json methods from core objects to json.rb