I was adding text compression to my website, and after i did that, the live website stopped working, it couldn’t fetch any pages. So I fired it up in localhost, and got the error:
FetchError: invalid json response body at https://backend.aamodtgroup.com/wp-json/wp/v2/pages?_embed=true&slug=hjem reason: Unexpected token < in JSON at position 29109
So I deactivated compression, and it started to work. But I still wanted to have compression, so I did some more digging. Turns out, I had wp_debug set to true, and when I activated compression, a notice about the gzip compression was added in the wp-json response, at the very end. So that is where the error came from.
So if any of you experience the same, make sure that you have wp_debug set to false.