
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
serialised-error
Advanced tools
This module attempts to convert an error object into a regular JavaScript object. This is useful if an error object has to be stored and operated upon.
var SerialisedError = require('serialised-error');
// assuming you have an error
var someError = new Error("This is a test error");
// convert the error to object (new operator is optional)
var serialisedError = new SerialisedError(someError);
// convert the serialised error to JSON
console.log(JSON.parse(serialisedError));
// this outputs:
// {"name": "Error", "message": "This is a test error", "stack": "Error\n at ..."}
Passing a second argument as true to the SerialisedError constructor adds the following keys to the serialised object.
| Property | Description |
|---|---|
checksum | a SHA1 checksum of the error that is constant for same name, message and stack |
id | a random UUID (v4) of the error |
timestamp | the time when the error was serialised |
timestampISO | the time (in ISO format) when the error was serialised |
stacktrace | a prettified array of stack traces |
npm install serialised-error;
The serialize-error package provides similar functionality by serializing error objects into JSON-compatible objects. It is widely used and offers a straightforward API for error serialization, similar to serialised-error.
The error-to-json package focuses on converting error objects to JSON format. It provides a simple way to handle error serialization, similar to serialised-error, but may not offer deserialization capabilities.
FAQs
Serialises error object to normal object
The npm package serialised-error receives a total of 557,026 weekly downloads. As such, serialised-error popularity was classified as popular.
We found that serialised-error demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.