JSON converts the snake_case keys in your data to camelCase.
Github repository for your stars.
$ npm install json-function
import { transform } from 'json-function';
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 5 years ago
Was this helpful?