
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
De/serialize json for consistency!
$ npm install ...
const { Serializer } = require('jsonade');
const userSerializer = new Serializer('user', {
attributes: ['firstName', 'lastName', 'address'],
address: {
attributes: ['street', 'number'],
},
});
const data = {
firstName: 'John',
lastName: 'Doe',
age: 27,
address: {
street: 'Markt',
number: '100',
city: 'Zonnedorp',
country: 'Belgium',
},
};
const result = userSerializer.serialize(data);
//
// {
// firstName: 'John',
// lastName: 'Doe',
// address: {
// street: 'Markt',
// number: '100',
// },
// }
const data = [
{
firstName: 'John',
lastName: 'Doe',
age: 27,
address: {
street: 'Markt',
number: '100',
city: 'Zonnedorp',
country: 'Belgium',
},
}, {
firstName: 'Jessie',
lastName: 'Doe',
age: 26,
address: {
street: 'Marketstreet',
number: '101',
city: 'Sunvillage',
country: 'United Kingdom',
},
}
];
const result = userSerializer.serialize(data);
// result:
// [
// {
// firstName: 'John',
// lastName: 'Doe',
// address: {
// street: 'Markt',
// number: '100',
// },
// },
// { ... },
// ]
const { Serializer } = require('jsonade');
const addressSerializer = new Serializer('address', {
attributes: ['street', 'number'],
});
const userSerializer = new Serializer('user', {
attributes: ['firstName', 'lastName', 'address'],
address: addresssSerializer,
});
const data = {
firstName: 'John',
lastName: 'Doe',
age: 27,
address: {
street: 'Markt',
number: '100',
city: 'Zonnedorp',
country: 'Belgium',
},
};
const result = userSerializer.serialize(data);
// result:
// {
// firstName: 'John',
// lastName: 'Doe',
// address: {
// street: 'Markt',
// number: '100',
// },
// }
const { Serializer } = require('jsonade');
const userSerializer = new Serializer('user', {
attributes: ['firstName', 'lastName', 'age'],
age: val => `${val} years old`,
});
const data = {
firstName: 'John',
lastName: 'Doe',
age: '27',
};
const result = userSerializer.serialize(data);
// result:
// {
// firstName: 'John',
// lastName: 'Doe',
// age: '27 years old',
// }
const { ErrorSerializer } = require('jsonade');
const errorResponse = ErrorSerializer.serialize(ex);
constructor
const mySerializer = new Serializer(resource, options);
resource (string)
: Name of the resource being serialized
options (Object)
: Options for serialisation
Options:
attributes (Array)
: attributes to serializeReturns an instance of a custom serializer, ready to use for serializing data.
serialize
mySerializer.serialize(data);
data (Object|Array)
: Dataset to serialize.
Returns a serialized data respresentation of the given data.
serialize
error (Object|Array)
: Error(s) to serialize.
const errors = ErrorSerializer.serialize([error]);
errors (Object)
: object containing multiple errors.Every error can have these properties:
key | |
---|---|
status | required |
title | required |
id | optional |
code | optional, application specific |
detail | optional |
meta | optional |
{
"errors": [
{
"id": "ba4b9f14-5b83-4dfd-ac46-1c3868e1b3ec",
"status": 400,
"code": "2006",
"title": "Article not found",
"detail": "Article with id 892bb574-090d-4d63-a5b5-cb928d5f5c5f not found",
"meta": {
"stack": "NotFoundError: ..."
}
}
]
}
FAQs
Json de/serialization made for consistency
The npm package jsonade receives a total of 42 weekly downloads. As such, jsonade popularity was classified as not popular.
We found that jsonade demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.