{"id":17454752,"url":"https://github.com/ionicabizau/json2md","last_synced_at":"2025-05-14T04:07:52.433Z","repository":{"id":45684738,"uuid":"45386983","full_name":"IonicaBizau/json2md","owner":"IonicaBizau","description":":pushpin: A JSON to Markdown converter.","archived":false,"fork":false,"pushed_at":"2025-04-11T10:16:28.000Z","size":236,"stargazers_count":597,"open_issues_count":6,"forks_count":82,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-12T20:43:22.859Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"http://ionicabizau.net/blog/27-how-to-convert-json-to-markdown-using-json2md","language":"JavaScript","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/IonicaBizau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"ionicabizau","patreon":"ionicabizau","open_collective":"ionicabizau","custom":"https://www.buymeacoffee.com/h96wwchmy"}},"created_at":"2015-11-02T10:13:38.000Z","updated_at":"2025-04-11T10:16:28.000Z","dependencies_parsed_at":"2025-02-28T22:00:36.735Z","dependency_job_id":"a423776c-9986-4245-bc7e-765762f89912","html_url":"https://github.com/IonicaBizau/json2md","commit_stats":{"total_commits":141,"total_committers":20,"mean_commits":7.05,"dds":"0.26241134751773054","last_synced_commit":"028ef4aac06e733dc24ef8ef3689786fb6c55b48"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonicaBizau%2Fjson2md","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonicaBizau%2Fjson2md/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonicaBizau%2Fjson2md/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonicaBizau%2Fjson2md/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IonicaBizau","download_url":"https://codeload.github.com/IonicaBizau/json2md/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254069626,"owners_count":22009558,"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","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":["hacktoberfest"],"created_at":"2024-10-18T01:41:19.582Z","updated_at":"2025-05-14T04:07:52.372Z","avatar_url":"https://github.com/IonicaBizau.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ionicabizau","https://patreon.com/ionicabizau","https://opencollective.com/ionicabizau","https://www.buymeacoffee.com/h96wwchmy","https://www.buymeacoffee.com/H96WwChMy","https://www.patreon.com/ionicabizau","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=RVXDDLKKLQRJW"],"categories":[],"sub_categories":[],"readme":"\u003c!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. --\u003e\n\n\n\n\n\n\n\n\n[![json2md](http://i.imgur.com/uj64JFw.png)](#)\n\n\n\n\n\n\n\n\n\n\n\n# json2md\n\n [![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [![Ask me anything](https://img.shields.io/badge/ask%20me-anything-1abc9c.svg)](https://github.com/IonicaBizau/ama) [![Version](https://img.shields.io/npm/v/json2md.svg)](https://www.npmjs.com/package/json2md) [![Downloads](https://img.shields.io/npm/dt/json2md.svg)](https://www.npmjs.com/package/json2md) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/@johnnyb?utm_source=github\u0026utm_medium=button\u0026utm_term=johnnyb\u0026utm_campaign=github)\n\n\u003ca href=\"https://www.buymeacoffee.com/H96WwChMy\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png\" alt=\"Buy Me A Coffee\"\u003e\u003c/a\u003e\n\n\n\n\n\n\n\n\u003e A JSON to Markdown converter.\n\n\n\n\n\n\nIf you're looking to use this on the client side, that's also possible. Check out the [`dist`](/dist) directory.\n\n\n\n\n\n\n\n\n\n\n\n\n## :cloud: Installation\n\n```sh\n# Using npm\nnpm install --save json2md\n\n# Using yarn\nyarn add json2md\n```\n\n\n\n\n\n\n\n\n\n\n\n\n\n## :clipboard: Example\n\n\n\n```js\nconst json2md = require(\"json2md\")\n\nconsole.log(json2md([\n    { h1: \"JSON To Markdown\" }\n  , { blockquote: \"A JSON to Markdown converter.\" }\n  , { img: [\n        { title: \"Some image\", source: \"https://example.com/some-image.png\" }\n      , { title: \"Another image\", source: \"https://example.com/some-image1.png\" }\n      , { title: \"Yet another image\", source: \"https://example.com/some-image2.png\" }\n      ]\n    }\n  , { h2: \"Features\" }\n  , { ul: [\n        \"Easy to use\"\n      , \"You can programmatically generate Markdown content\"\n      , \"...\"\n      ]\n    }\n  , { h2: \"How to contribute\" }\n  , { ol: [\n        \"Fork the project\"\n      , \"Create your branch\"\n      , \"Raise a pull request\"\n      ]\n    }\n  , { h2: \"Code blocks\" }\n  , { p: \"Below you can see a code block example.\" }\n  , { \"code\": {\n        language: \"js\"\n      , content: [\n          \"function sum (a, b) {\"\n        , \"   return a + b\"\n        , \"}\"\n        , \"sum(1, 2)\"\n        ]\n      }\n    }\n]))\n// =\u003e\n// # JSON To Markdown\n// \u003e A JSON to Markdown converter.\n//\n// ![Some image](https://example.com/some-image.png)\n//\n// ![Another image](https://example.com/some-image1.png)\n//\n// ![Yet another image](https://example.com/some-image2.png)\n//\n// ## Features\n//\n//  - Easy to use\n//  - You can programmatically generate Markdown content\n//  - ...\n//\n// ## How to contribute\n//\n//  1. Fork the project\n//  2. Create your branch\n//  3. Raise a pull request\n//\n// ## Code blocks\n//\n// Below you can see a code block example.\n//\n// ```js\n// function sum (a, b) {\n//    return a + b\n// }\n// sum(1, 2)\n// ```\n```\n\n\n\n\n\n\n\n\n\n\n\n## :memo: Documentation\n\n\n### `json2md(data, prefix)`\nConverts a JSON input to markdown.\n\n**Supported elements**\n\n| Type         | Element            | Data                                                                                                                     | Example                                                                                                                                          |\n|--------------|--------------------|--------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| `h1`         | Heading 1          | The heading text as string.                                                                                              | `{ h1: \"heading 1\" }`                                                                                                                            |\n| `h2`         | Heading 2          | The heading text as string.                                                                                              | `{ h2: \"heading 2\" }`                                                                                                                            |\n| `h3`         | Heading 3          | The heading text as string.                                                                                              | `{ h3: \"heading 3\" }`                                                                                                                            |\n| `h4`         | Heading 4          | The heading text as string.                                                                                              | `{ h4: \"heading 4\" }`                                                                                                                            |\n| `h5`         | Heading 5          | The heading text as string.                                                                                              | `{ h5: \"heading 5\" }`                                                                                                                            |\n| `h6`         | Heading 6          | The heading text as string.                                                                                              | `{ h6: \"heading 6\" }`                                                                                                                            |\n| `p`          | Paragraphs         | The paragraph text as string or array (multiple paragraphs).                                                             | `{ p: \"Hello World\"}` or multiple paragraphs: `{ p: [\"Hello\", \"World\"] }`                                                                        |\n| `blockquote` | Blockquote         | The blockquote as string or array (multiple blockquotes)                                                                 | `{ blockquote: \"Hello World\"}` or multiple blockquotes: `{ blockquote: [\"Hello\", \"World\"] }`                                                     |\n| `img`        | Image              | An object or an array of objects containing the `title`, `source` and `alt`  fields.                                     | `{ img: { title: \"My image title\", source: \"http://example.com/image.png\", alt: \"My image alt\" } }`                                              |\n| `ul`         | Unordered list     | An array of strings or lists representing the items.                                                                     | `{ ul: [\"item 1\", \"item 2\"] }`                                                                                                                   |\n| `ol`         | Ordered list       | An array of strings or lists representing the items.                                                                     | `{ ol: [\"item 1\", \"item 2\"] }`                                                                                                                   |\n| `hr`         | Separator          | None                                                                                                                     | `{ hr: \"\" }`                                                                                                                                     |\n| `code`       | Code block element | An object containing the `language` (`String`) and `content` (`Array` or `String`)  fields.                              | `{ code: { \"language\": \"html\", \"content\": \"\u003cscript src='dummy.js'\u003e\u003c/script\u003e\" } }`                                                                |\n| `table`      | Table              | An object containing the `headers` (`Array` of `String`s) and `rows` (`Array` of `Array`s or `Object`s).                 | `{ table: { headers: [\"a\", \"b\"], rows: [{ a: \"col1\", b: \"col2\" }] } }` or `{ table: { headers: [\"a\", \"b\"], rows: [[\"col1\", \"col2\"]] } }`         |\n| `link`       | Link               | An object containing the `title` and the `source` fields.                                                                | `{ title: 'hello', source: 'https://ionicabizau.net' }`                                                                                          |\n\nYou can extend the `json2md.converters` object to support your custom types.\n\n```js\njson2md.converters.sayHello = function (input, json2md) {\n   return \"Hello \" + input + \"!\"\n}\n```\n\nThen you can use it:\n\n```js\njson2md({ sayHello: \"World\" })\n// =\u003e \"Hello World!\"\n```\n\n#### Params\n\n- **Array|Object|String** `data`: The input JSON data.\n- **String** `prefix`: A snippet to add before each line.\n\n#### Return\n- **String** The generated markdown result.\n\n### async\n\n#### Params\n\n- **Array|Object|String** `data`: The input JSON data.\n- **String** `prefix`: A snippet to add before each line.\n\n#### Return\n- **Promise.\\\u003cString\u003e** The generated markdown result.\n\n\n\n\n\n\n\n\n\n## :question: Get Help\n\nThere are few ways to get help:\n\n\n\n 1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.\n 2. For bug reports and feature requests, open issues. :bug:\n 3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## :yum: How to contribute\nHave an idea? Found a bug? See [how to contribute][contributing].\n\n\n## :sparkling_heart: Support my projects\nI open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously,\nthis takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute (even resell it).\n\nHowever, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:\n\n\n - Starring and sharing the projects you like :rocket:\n - [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you after years if you buy me one. :grin: :book:\n - [![PayPal][badge_paypal]][paypal-donations]—You can make one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea:\n - [![Support me on Patreon][badge_patreon]][patreon]—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).\n - **Bitcoin**—You can send me bitcoins at this address (or scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6`\n\n    ![](https://i.imgur.com/z6OQI95.png)\n\n\nThanks! :heart:\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## :dizzy: Where is this library used?\nIf you are using this library in one of your projects, add it in this list. :sparkles:\n\n - `@aligov/module-doc`\n - `@apica-io/asm-auto-deploy`\n - `@asyncapi/diff`\n - `@balmacefa/function_tool_kit`\n - `@best/github-integration`\n - `@best/store`\n - `@bonitasoft/dependency-list-to-markdown`\n - `@bwagener/gridsome-source-google-docs`\n - `@cloudcatalog/cli`\n - `@cloudcatalog/cli-test`\n - `@cobalt-engine/change-logger`\n - `@cypress/schema-tools`\n - `@dididc/dc-extension`\n - `@dlsl/hardhat-markup`\n - `@dschau/gatsby-source-google-docs`\n - `@e2y/bdd-dictionary-generator`\n - `@enrico.piccinin/gitlab-tools`\n - `@eventcatalog/plugin-doc-generator-asyncapi`\n - `@eventcatalog/utils`\n - `@eventcatalogtest/plugin-doc-generator-asyncapi`\n - `@feizheng/react-markdown-props`\n - `@flive/react-kit`\n - `@gigsboat/cli`\n - `@gracexwho/model-card-generator`\n - `@haimmag/schema-tools`\n - `@hankanman/postgres-to-docs`\n - `@hitorisensei/markdown-readme-generator`\n - `@hitorisensei/monorepo-readme-generator`\n - `@jswork/react-markdown-props`\n - `@klarna/postgres-to-docs`\n - `@lm_fe/scripts`\n - `@medyll/css-fabric-helper`\n - `@mfbtech/changelog-generator`\n - `@microfleet/schema2md`\n - `@mjefi/instags`\n - `@oasis-engine/oasis-run`\n - `@opas/plugin-doc`\n - `@r6d9/kol-tracker`\n - `@r6d9/kol_tracker`\n - `@s-ui/changelog`\n - `@servable/manifest`\n - `@servable/tools`\n - `@shelex/schema-tools`\n - `@sidneys/releasenotes`\n - `@solarity/hardhat-markup`\n - `@solarity/hardhat-migrate`\n - `@truto/truto-jsonata`\n - `@wii/swagger-plugin-transform-doc`\n - `@xygengcn/koa-api-docs`\n - `@yesand/asterism`\n - `bookmark2md`\n - `ccdown`\n - `chdown`\n - `chdown-workers`\n - `cli-demo3`\n - `cloudcastsdown`\n - `codexer`\n - `collman`\n - `component-docs-2md`\n - `cwq`\n - `dargstack_rgen`\n - `describe-dependencies`\n - `doc-cli`\n - `doc-vue`\n - `doc-vue3`\n - `dokuinjs`\n - `eddown`\n - `flawed-code-scanner`\n - `galaxy-vuepress-docs`\n - `gatsby-source-gdocs2md`\n - `gatsby-source-google-docs`\n - `gatsby-source-google-docs-sheets`\n - `gatsby-source-google-docs-team`\n - `git-diff-llm`\n - `github-repo-tools`\n - `gridsome-source-google-docs`\n - `heat-sfdx-tooling`\n - `joi-md-doc`\n - `jumia-travel-changelog`\n - `kbase-components`\n - `kindle-highlights`\n - `kol-tracker`\n - `kol_analyzer`\n - `lab-changelog`\n - `lambda-docs-2md`\n - `laradown`\n - `lbdoc-p`\n - `lggn`\n - `machine-ip`\n - `make-postgres-markdown`\n - `mcp-douban-server`\n - `merak-compile`\n - `mokker`\n - `msdown`\n - `my_ccdown`\n - `mysql-ksdb`\n - `node-red-contrib-json2md`\n - `notion2mdblog`\n - `npm-ex-xpi`\n - `p2doc`\n - `pantheon_site_management`\n - `parse-google-docs-json`\n - `platzi-virtual-machine`\n - `postgres-markdown`\n - `rap2doc`\n - `react-docgen-markdown`\n - `reposier`\n - `rober19-config`\n - `rush-archive-project-plugin`\n - `sfhdown`\n - `solidity-benchmark`\n - `tcdown`\n - `terraform2md`\n - `type-graphql-to-md`\n - `utterance-to-markdown`\n - `uxcore-tools`\n - `vue-md-gen`\n - `vue2markdown`\n - `work-webpack`I am using this library to generate documentation for my projects, being integrated with [blah](https://github.com/IonicaBizau/node-blah).\n\n\n\n\n\n\n\n\n\n\n\n## :scroll: License\n\n[MIT][license] © [Ionică Bizău][website]\n\n\n\n\n\n\n[license]: /LICENSE\n[website]: https://ionicabizau.net\n[contributing]: /CONTRIBUTING.md\n[docs]: /DOCUMENTATION.md\n[badge_patreon]: https://ionicabizau.github.io/badges/patreon.svg\n[badge_amazon]: https://ionicabizau.github.io/badges/amazon.svg\n[badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg\n[badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg\n[patreon]: https://www.patreon.com/ionicabizau\n[amazon]: http://amzn.eu/hRo9sIZ\n[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=RVXDDLKKLQRJW\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fionicabizau%2Fjson2md","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fionicabizau%2Fjson2md","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fionicabizau%2Fjson2md/lists"}