Transform
JSON converts the snake_case keys in your data to camelCase.
Github repository for your stars.
Usage
Install
$ npm install json-function
Import
import { transform } from 'json-function';
Usage
Example Data
const data = [
{
id: 1,
user_id: 10,
skils: [
{
id: 2,
skill_name: 'Skill 1',
}
],
info: {
info_address: 'Address',
detail: {
zip_code: 30000,
}
}
}
];
Default key
transform(data);
Output
[
{
id: 1,
userId: 10,
skils: [
{
id: 2,
skillName: 'Skill 1',
}
],
info: {
infoAddress: 'Address',
detail: {
zipCode: 30000,
}
}
}
];
Last updated
Was this helpful?