I have a Java application and I would like to compress content of certain String variable (as it's a huge JSON). Now, i saw a lot of examples where i can compress String into byte array, but as my application has to (optionally!) send that compressed data as a REST response (i'm using Java Spark) i would like to compress that String into another (smaller) string.
Not sure if that's really possible, that's why i'm here :)
Why i don't wanna send byte array over network? Because my response has two parts - metadata and actual data returned from the DB. I would like to keep metadata readable and only actual data compressed.
Is there a way to achieve this?