title: ExpressJs Trim middleware for nested req.body data
body: <p>How could I create a middleware to trim all <em>req.body</em> data even <strong>NESTED</strong> data?</p>
  <p>I also accept a trusted well coded package.</p>
  <p>Noting that I am using <strong>true</strong> here :
  <code>app.use(bodyParser.urlencoded({ extended: true })); </code></p>
  <p>this code ref <a href="https://stackoverflow.com/questions/30266295/using-express-can-i-automatically-trim-all-incoming-posted-fields-in-req-body">question</a></p>
  <pre><code>  trim: (req, res, next) =&gt; {
      if (req.method === 'POST') {
        for (const [key, value] of Object.entries(req.body)) {
          if (typeof value === 'string') req.body[key] = value.trim();
        }
      }
      next();
    }
  </code></pre>
  <p>This one will work but not for nested data</p>