title: How to compress json to get it with `bodyParser.json`
body: <p>I want to send to my server a compressed json.</p>
  
  <p>I prefer to compress the data in browser.(<a href="https://github.com/wicg/compression/blob/master/explainer.md" rel="nofollow noreferrer">explainer</a>) and get it to bodyParser.json middleware.</p>
  
  <p>client side function something like this:</p>
  
  <pre><code>export function compressGzip(input) {
    const stream = new Response(input).body.pipeThrough(
      new CompressionStream('gzip')
    )
    return new Response(stream)
  }
  </code></pre>
  
  <p>my request in react.js:</p>
  
  <pre><code>return fetch(url, {
      headers: {
        'Content-Type':'application/json',
        'content-encoding': 'gzip'
      },
      method: 'POST',
      body: bodyContent
    }).then(res =&gt; res.blob())
  </code></pre>
  
  <p>node.js:</p>
  
  <pre><code>app.use(
    bodyParser.json({
      limit: "10mb"
    })
  );
  </code></pre>
  
  <p>What is the way to do the compression according to this data and does it make sense?</p>
  
  <p>Thank in advance!</p>