JSON-CONVERSION-TOOL
NPM
Github
Description
Provides functions for converting JSON objects to and from CSVs.
Try me out
Usage
Example
;;;;;;
CSV Output
id,personalInfo.firstName,personalInfo.lastName,personalInfo.title,jobInfo.department,jobInfo.title,Awards,warnings
1,John,Smith,Mr,HR,HR Assistant,1,
2,Jane,Doe,Mrs,Sales,Sales Executive,,
3,John,Doe,Mr,R&D,Data Scientist,,1
Awards
year,title
2016,Best at Everything
warnings
year,reason
2016,Farted in the coffee machine
Markdown Output
Converted JSON
id | personalInfo.firstName | personalInfo.lastName | personalInfo.title | jobInfo.department | jobInfo.title | Awards | warnings |
---|---|---|---|---|---|---|---|
1 | John | Smith | Mr | HR | HR Assistant | 1 | |
2 | Jane | Doe | Mrs | Sales | Sales Executive | ||
3 | John | Doe | Mr | R&D | Data Scientist | 1 |
Awards
year | title |
---|---|
2016 | Best at Everything |
warnings
year | reason |
---|---|
2016 | Farted in the coffee machine |
HTML (custom) Output
Converted JSONidpersonalInfo.firstNamepersonalInfo.lastNamepersonalInfo.titlejobInfo.departmentjobInfo.titleAwardswarnings1JohnSmithMrHRHR Assistant12JaneDoeMrsSalesSales Executive3JohnDoeMrR&DData Scientist1Awardsyeartitle2016Best at Everythingwarningsyearreason2016Farted in the coffee machine
Dot notation
You can also specify specifc fields to get based on dot notation, such as:
new OutputGenerator
Or
new OutputGenerator
Contributing
- Clone the repo and run
npm install
. - Create a new feature branch:
git checkout -b feature/your-feature-branch-name
. - Write a test in the
__tests__
folder for your feature. - Write the code to get the test passing, running
npm run test
. - Push your branch up and submit a pull request.
Note: I have configured a launch.json for vscode that should allow for playing around with anything in index.ts and hitting f5 to debug.
Publishing
- npm version patch
- npm publish