Implement #as_json, accept arbitrary paramters for #to_json.