
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.
@fulminate/serializer
Advanced tools
FS simplifies the process of serialization for objects of any kind. The original idea of this package was to create an easy way of serializing objects that arrive from TypeORM.
npm install --save @fulminate/serializer
import { Serializer } from "@fulminate/serializer";
let obj = {
"id": 1,
"title": "Foo",
"description": "Bar",
}
let serializer : Serializer = new Serializer();
console.dir(serializer.serialize(obj, [
"title",
"description",
]));
// Output:
// Object { title: "Foo", description: "Bar" }
var serializer = require("@fulminate/serializer").Serializer;
var obj = {
"id": 1,
"title": "Foo",
"description": "Bar"
}
console.dir(serializer.serialize(obj, ["title", "description"]));
// Output:
// Object { title: "Foo", description: "Bar" }
JSON.stringify() should be applied on the output..-separated field names to serializationFields array). Bear in mind that currently serializer can only
go one level deep (e.g. ["user.credentials.socialNetworks"] will only apply serialization to user and credentials, but NOT socialNetworks).import {Serializer} from "@fulminate/serializer";
let object = {
db: {
name: "database",
port: 3306,
host: "localhost",
user: "root",
pass: "",
},
name: "Ostap",
surname: "Bender",
};
let objectArray = [object, object, object];
console.dir(new Serializer().serialize(object, ["db.port", "name"], false));
console.dir(new Serializer().serialize(objectArray, ["db.port", "db.user", "name"], false));
// Output: { db: { name: 'database', host: 'localhost', user: 'root', pass: '' },
// surname: 'Bender' }
// [ { db: { name: 'database', host: 'localhost', pass: '' },
// surname: 'Bender' },
// { db: { name: 'database', host: 'localhost', pass: '' },
// surname: 'Bender' },
// { db: { name: 'database', host: 'localhost', pass: '' },
// surname: 'Bender' } ]
Read more about:
import { Serializer } from "@fulminate/serializer";
import { JsonController, Get } from "routing-controllers";
import { getConnectionManager, Repository } from "typeorm";
import { User } from "/* PATH_TO_USER_MODEL */";
@JsonController()
export class UserController {
private userRepository : Repository<User>;
private serializer : Serializer;
constructor() {
this.userRepository = getConnectionManager().get().getRepository(User);
this.serializer = new Serializer();
}
@Get("/users")
async getAll() {
return this.serializer.serialize(await this.userRepository.find(), User.SHORT_RESPONSE);
}
}
import { ColumnTypes } from "typeorm/metadata/types/ColumnTypes";
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm";
@Entity("account_users", {
engine: "InnoDB",
})
export class User {
public static readonly SHORT_RESPONSE : Array<string> = [
"id",
"username",
];
@PrimaryGeneratedColumn()
id : number;
@Column(ColumnTypes.STRING, {
unique: true,
length: 30,
})
username : string;
@Column(ColumnTypes.STRING, {
length: 50,
})
password : string;
}
On the page, you will see:
[
{
"__comment": {
"title": "This will NOT appear in your JSON output, it is just a comment to deliver a message to you personally",
"message": "Assuming you have users in your DB you will see results for each of them serialized"
}
},
{
"id": "ID_OF_SERIALIZED_USER",
"username": "USERNAME_OF_SERIALIZED_USER"
}
]
FAQs
An easy way of serializing objects.
We found that @fulminate/serializer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.