I'm currently returning JSON query data via ElasticSearch, but returns have a lot of information and using json_decode to manipulate this data becomes very costly for the server.
For example, the server memory usage is at 5MB when returning the pure JSON from the ES, but when using json_decode the memory usage goes to 300MB, and the problem only increases with the amount of data.
Is there an alternative that does not consume so much memory from the server and bring the JSON exactly as it is written in the original JSON string?