Sign in
Log inSign up

What is the best way to calculate the size of a JSON object in Node.js?

Jeremy Wright's photo
Jeremy Wright
·Apr 28, 2016

My API consumes JSON and saves it in a record. However, I would like to impose a size limit on the object. For example, in MongoDB the document size must be less than 16MB. How should I go about it in Node.js?

Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2025 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct