ESSerializer is a JavaScript serialization and deserialization utility. It enables the conversion of JavaScript class instances into JSON format and their subsequent reconstruction back into fully functional objects, ensuring that all Class, Property, and Method information is retained recursively. The library operates without relying on `eval()`, which eliminates a common security vulnerability associated with many serialization methods. ESSerializer supports a broad spectrum of built-in JavaScript classes and types, including various Array types, Date, RegExp, BigInt, and all standard Error classes. It is designed to work seamlessly in both browser and Node.js environments. The current stable version, 1.3.11, receives ongoing maintenance with recent releases focusing on minor bug fixes and security vulnerability patches, indicating an active development and stable release cadence. Its key differentiators include robust recursive class retention, automatic class definition detection during serialization and deserialization, comprehensive support for getter/setter properties and `instanceof` checks, and compatibility with both modern ES6 classes and older function-style class definitions.
npm install esserializerVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the serialization and deserialization of nested class instances, verifying method and type retention.
Update esserializer to version `1.3.7` or later: `npm install esserializer@latest`
For these advanced use cases, refer to the 'ESSerializer Pro' documentation or implement custom serialization/deserialization logic for specific types.
Ensure all custom class definitions are passed in an array to `ESSerializer.deserialize(serializedString, [ClassA, ClassB, ...])`.
Pass all custom class definitions as an array to `ESSerializer.deserialize(serializedString, [ClassName1, ClassName2, ...])`.
Verify that all relevant class definitions are correctly imported and passed to the `deserialize` method. For example: `ESSerializer.deserialize(serializedData, [MyCustomClass]);`
Either refactor your object structure to avoid circular references, or consider using 'ESSerializer Pro' which explicitly supports this feature.
For ES Modules: `import ESSerializer from 'esserializer';`. For CommonJS: `const ESSerializer = require('esserializer');`.No dependency data recorded yet.