Unexpected behaviour of df.to_json(compression="gzip")
#### Code Sample

```python
import pandas as pd

df = pd.DataFrame({"a": [1, 2, 3, 4], "b": ["A", "B", "C", "D"],})
json_df = df.to_json(lines=True, orient="records", compression="gzip")
print(json_df)
```
#### Problem description

The behavior of the "compression" argument is unexpected. It doesn't have any effect. Although [it is documented](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_json.html) that it is only applied if there is a filename argument, there should at very least be a warning if compression is set, but no filename is given.

Also: Why doesn't it have an effect? Couldn't we output a bytes object?