Currently, we have to wait for the response from the upstream server to be entirely sent, the to load it entirely in memory to analyze and modify the received JSON document.
Analyzing and modifying the JSON stream on the go could improve the memory usage (but probably not the overall performance because we need to compute and to send the Content-Length HTTP header before the JSON body anyway).
Currently, we have to wait for the response from the upstream server to be entirely sent, the to load it entirely in memory to analyze and modify the received JSON document. Analyzing and modifying the JSON stream on the go could improve the memory usage (but probably not the overall performance because we need to compute and to send the
Content-Length
HTTP header before the JSON body anyway).This isn't an easy pick because gjson doesn't support JSON streams for now (https://github.com/tidwall/gjson/issues/25, https://github.com/tidwall/gjson/issues/78). We'll have to use
json.Decoder
directly or to create a new library for this.