Created
September 29, 2020 06:20
-
-
Save corneliouzbett/f11c6716c05888ad3939447b429d7cb8 to your computer and use it in GitHub Desktop.
Typescript code snippet that splits JSON file array into multiple files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const jsonArr = require('./file.json'); | |
jsonArr.forEach( (item) => { item.writeFileSync('itemsFolder/' + item.id + '.json', JSON.stringify(item) ); } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment