Add various #as_json methods to core classes