serialize-javascript securely serializes JavaScript values into a superset of JSON that includes regular expressions, Dates, and functions. It mitigates XSS risks by escaping unsafe characters and HTML metacharacters. Useful for embedding JavaScript data directly into HTML, particularly when server-side rendering. Handles circular references and prevents prototype pollution. Offers options to specify unsafe mode, allowing potentially dangerous JavaScript to be serialized when needed, but requires caution.
The serialize-javascript package had sporadic releases from 2014 to 2025. Releases were most frequent in 2018 and 2019. The last release was in January 2024 (version 6.0.2). There have been no releases in 2025 as of September 11, 2025. The package's release frequency appears highly variable.
Serialize-javascript npm package downloads saw consistent activity throughout 2024 and early 2025, generally ranging from 110 million to 178 million monthly. Downloads peaked in June 2025 at 214 million before decreasing in August. September 2025 downloads are significantly lower due to incomplete data for the month.