Hash[nested_hash.map {|k,v| [k,(v.respond_to?(:except)?v.except("nested_key2"):v)] }] => {"key1"=>"value1", "key2"=>{"nested_key1"=>"nestedvalue1"}}