{"id":21065016,"url":"https://github.com/rogue-elephant/json-conversion-tool","last_synced_at":"2025-08-11T00:48:17.053Z","repository":{"id":36469866,"uuid":"226689225","full_name":"rogue-elephant/json-conversion-tool","owner":"rogue-elephant","description":"Provides functionality for converting JSON objects into a relational structure and then outputting to various formats (csv, markdown, html etc.)","archived":false,"fork":false,"pushed_at":"2023-01-05T02:34:25.000Z","size":934,"stargazers_count":2,"open_issues_count":16,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-09T09:13:17.724Z","etag":null,"topics":["json","json-conversion","json-to-csv","json-to-html","json-to-markdown"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rogue-elephant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-08T15:32:25.000Z","updated_at":"2025-05-21T21:49:20.000Z","dependencies_parsed_at":"2023-01-17T01:47:12.509Z","dependency_job_id":null,"html_url":"https://github.com/rogue-elephant/json-conversion-tool","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/rogue-elephant/json-conversion-tool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogue-elephant%2Fjson-conversion-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogue-elephant%2Fjson-conversion-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogue-elephant%2Fjson-conversion-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogue-elephant%2Fjson-conversion-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rogue-elephant","download_url":"https://codeload.github.com/rogue-elephant/json-conversion-tool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rogue-elephant%2Fjson-conversion-tool/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269734044,"owners_count":24466545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","json-conversion","json-to-csv","json-to-html","json-to-markdown"],"created_at":"2024-11-19T17:53:13.181Z","updated_at":"2025-08-11T00:48:16.996Z","avatar_url":"https://github.com/rogue-elephant.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSON-CONVERSION-TOOL\n\n#### NPM\n[![json-conversion-tool npm](https://img.shields.io/npm/v/json-conversion-tool?label=json-conversion-tool\u0026logo=npm)](https://www.npmjs.com/package/json-conversion-tool)\n\n![](https://img.shields.io/npm/dm/json-conversion-tool?logo=npm)\n[![libraries io](https://img.shields.io/librariesio/release/npm/json-conversion-tool)](https://libraries.io/npm/json-conversion-tool)\n[![snyk](https://img.shields.io/snyk/vulnerabilities/npm/json-conversion-tool)](https://snyk.io/vuln/search?q=json-conversion-tool\u0026type=npm)\n![](https://img.shields.io/bundlephobia/min/json-conversion-tool) ![](https://img.shields.io/npm/l/json-conversion-tool)\n\n#### Github\n![](https://img.shields.io/github/last-commit/rogue-elephant/json-conversion-tool)\n![](https://img.shields.io/github/issues-raw/rogue-elephant/json-conversion-tool)\n![](https://img.shields.io/github/issues-closed-raw/rogue-elephant/json-conversion-tool)\n![](https://img.shields.io/badge/using-typescript-008866?style=flat\u0026logo=typescript)\n\n## Description\nProvides functions for converting JSON objects to and from CSVs.\n\n## Try me out\n[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io#https://github.com/rogue-elephant/json-conversion-tool)\n\n# Usage\n\n## Example\n``` typescript\nconst deeperPersonJson = [\n    {\n        id: 1,\n        personalInfo: {\n            firstName: 'John',\n            lastName: 'Smith',\n            title: 'Mr'\n        },\n        jobInfo: {\n            department: 'HR',\n            title: 'HR Assistant',\n        },\n        Awards: [\n            {\n                year: 2016,\n                title: 'Best at Everything'\n            }\n        ]\n    },\n    {\n        id: 2,\n        personalInfo: {\n            firstName: 'Jane',\n            lastName: 'Doe',\n            title: 'Mrs'\n        },\n        jobInfo: {\n            department: 'Sales',\n            title: 'Sales Executive',\n        }\n    },\n    {\n        id: 3,\n        personalInfo: {\n            firstName: 'John',\n            lastName: 'Doe',\n            title: 'Mr'\n        },\n        jobInfo: {\n            department: 'R\u0026D',\n            title: 'Data Scientist',\n        },\n        warnings: [\n            {\n                year: 2016,\n                reason: 'Farted in the coffee machine'\n            }\n        ]\n    },\n];\n\nconst relationalJson: RelationalJson = new Converter().convertJson(DeeperPersonJson, {});\nconst outputGenerator = new OutputGenerator(relationalJson);\nconst csv = outputGenerator.generateCsv();\nconst markdown = outputGenerator.generateMarkdown();\nconst html = outputGenerator.generateOutput({\n  columnSeperator: '',\n  tableLevelCallback: (output: string, table: RelationalJson) =\u003e\n    output + `\u003ch1\u003e${table.title}\u003c/h1\u003e` + '\u003ctable\u003e\u003ctr\u003e' + table.columnNames.map(x =\u003e `\u003cth\u003e${x}\u003c/th\u003e`).join('') + '\u003c/tr\u003e',\n  rowLevelCallback: (rowCol: IRowValue) =\u003e `\u003ctd\u003e${rowCol.value}\u003c/td\u003e`,\n  rowStartOutput: '\u003ctr\u003e',\n  rowEndOutput: '\u003c/tr\u003e',\n  tableEndOutput: '\u003c/table\u003e',\n  tableSpacing: '\u003cbr\u003e',\n});\n```\n\n### CSV Output\n```\nid,personalInfo.firstName,personalInfo.lastName,personalInfo.title,jobInfo.department,jobInfo.title,Awards,warnings\n1,John,Smith,Mr,HR,HR Assistant,1,\n2,Jane,Doe,Mrs,Sales,Sales Executive,,\n3,John,Doe,Mr,R\u0026D,Data Scientist,,1\n\nAwards\nyear,title\n2016,Best at Everything\n\nwarnings\nyear,reason\n2016,Farted in the coffee machine\n```\n\n### Markdown Output\n----------------------------------------------------------------------------------------------\n# Converted JSON \u003ca name=\"Converted JSON\"\u003e\u003c/a\u003e\n|*id*|*personalInfo.firstName*|*personalInfo.lastName*|*personalInfo.title*|*jobInfo.department*|*jobInfo.title*|*Awards*|*warnings*\n|---|---|---|---|---|---|---|---\n1|John|Smith|Mr|HR|HR Assistant|[1](#Awards)|\n2|Jane|Doe|Mrs|Sales|Sales Executive||\n3|John|Doe|Mr|R\u0026D|Data Scientist||[1](#warnings)\n\n# Awards \u003ca name=\"Awards\"\u003e\u003c/a\u003e\n|*year*|*title*\n|---|---\n2016|Best at Everything\n\n# warnings \u003ca name=\"warnings\"\u003e\u003c/a\u003e\n|*year*|*reason*\n|---|---\n2016|Farted in the coffee machine\n----------------------------------------------------------------------------------------------\n\n### HTML (custom) Output\n``` html\n\u003ch1\u003eConverted JSON\u003c/h1\u003e\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eid\u003c/th\u003e\n        \u003cth\u003epersonalInfo.firstName\u003c/th\u003e\n        \u003cth\u003epersonalInfo.lastName\u003c/th\u003e\n        \u003cth\u003epersonalInfo.title\u003c/th\u003e\n        \u003cth\u003ejobInfo.department\u003c/th\u003e\n        \u003cth\u003ejobInfo.title\u003c/th\u003e\n        \u003cth\u003eAwards\u003c/th\u003e\n        \u003cth\u003ewarnings\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e1\u003c/td\u003e\n        \u003ctd\u003eJohn\u003c/td\u003e\n        \u003ctd\u003eSmith\u003c/td\u003e\n        \u003ctd\u003eMr\u003c/td\u003e\n        \u003ctd\u003eHR\u003c/td\u003e\n        \u003ctd\u003eHR Assistant\u003c/td\u003e\n        \u003ctd\u003e1\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e2\u003c/td\u003e\n        \u003ctd\u003eJane\u003c/td\u003e\n        \u003ctd\u003eDoe\u003c/td\u003e\n        \u003ctd\u003eMrs\u003c/td\u003e\n        \u003ctd\u003eSales\u003c/td\u003e\n        \u003ctd\u003eSales Executive\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e3\u003c/td\u003e\n        \u003ctd\u003eJohn\u003c/td\u003e\n        \u003ctd\u003eDoe\u003c/td\u003e\n        \u003ctd\u003eMr\u003c/td\u003e\n        \u003ctd\u003eR\u0026D\u003c/td\u003e\n        \u003ctd\u003eData Scientist\u003c/td\u003e\n        \u003ctd\u003e1\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\u003cbr\u003e\n\u003ch1\u003eAwards\u003c/h1\u003e\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eyear\u003c/th\u003e\n        \u003cth\u003etitle\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e2016\u003c/td\u003e\n        \u003ctd\u003eBest at Everything\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\u003cbr\u003e\n\u003ch1\u003ewarnings\u003c/h1\u003e\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003cth\u003eyear\u003c/th\u003e\n        \u003cth\u003ereason\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd\u003e2016\u003c/td\u003e\n        \u003ctd\u003eFarted in the coffee machine\u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n```\n\n## Dot notation\nYou can also specify specifc fields to get based on dot notation, such as:\n``` typescript\nnew OutputGenerator({ new Converter().convertJson(apiJson,{whiteList: ['prefs.backgroundImageScaled.url'])});\n```\n\nOr \n``` typescript\nnew OutputGenerator({ new Converter().convertJson(apiJson,{whiteList: ['name', 'cards.*'])});\n```\n\n## Contributing\n- Clone the repo and run `npm install`.\n- Create a new feature branch: `git checkout -b feature/your-feature-branch-name`.\n- Write a test in the `__tests__` folder for your feature.\n- Write the code to get the test passing, running `npm run test`.\n- Push your branch up and submit a pull request.\n\nNote: I have configured a launch.json for vscode that should allow for playing around with anything in index.ts and hitting f5 to debug.\n\n## Publishing\n- npm version patch\n- npm publish\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogue-elephant%2Fjson-conversion-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frogue-elephant%2Fjson-conversion-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frogue-elephant%2Fjson-conversion-tool/lists"}