I have met one difficulty though. There's a lot of stuff I don't need in the json in certain views. For example I'd like to download the entire website data in one single paged json. That'd allow me to do things like filtering posts, data and so on, directly from user's machine.
However, to optimize this, I need to filter a lot of contents from the original json object. Suppose I query the wp-json.php/posts/ route... I have a lot of post data which I don't need. Content, some post_meta, feature image data, taxonomies... Suppose I'd want only few things like IDs, title, excerpt... How to remove all the rest?
I tried 'json_prepare_post' filter, but I wasn't able to conditionally alter content, say, on usual WordPress query conditionals (is_singular(), is_archive()...). If I attempt to do this, it will filter the json also in posts/id route (the singular view, which I need to be complete) I haven't figured out how to do this. I don't think it should be necessary to write an entire new route...