# md-2-json

> Markdown to JSON convertor

Latest version **2.0.0** (published 2021-05-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install md-2-json
pnpm add md-2-json
yarn add md-2-json
bun add md-2-json
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2021-05-18 |
| First published | 2017-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.3 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | ajithr |
| Maintainers | ajithr11 |
| Keywords | md-to-json, markdown, markdown-to-json, md2json, md-2-json, mdjson, json, parser |

## Links

- npm: https://www.npmjs.com/package/md-2-json
- Repository: https://github.com/ajithr/md-2-json
- Homepage: https://github.com/ajithr/md-2-json#readme
- Issues: https://github.com/ajithr/md-2-json/issues
- npm.io page: https://npm.io/package/md-2-json

## Dependencies (2)

- [marked](https://npm.io/package/marked.md) ^2.0.3
- [traverse](https://npm.io/package/traverse.md) ^0.6.6

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.0.0 (latest) — 2021-05-18
- 1.0.6 — 2019-07-17
- 1.0.5 — 2017-11-10
- 1.0.4 — 2017-11-07
- 1.0.3 — 2017-10-26
- 1.0.2 — 2017-09-15
- 1.0.1 — 2017-09-14
- 1.0.0 — 2017-09-13

## README

# MARKDOWN-TO-JSON

A simple library to convert markdown content to JSON object.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save md-2-json
```

## Usage

### Simple content

```js

var md2json = require('md-2-json');

md2json.parse('This is a markdown content');

/* output
{
    raw: "This is a markdown content\n"
}
*/

```

### Multiline Content

```js

var md2json = require('md-2-json');
var mdContent = `
# Heading 1

This is a para

- This is a list

## Heading 2

This is a para
`

md2json.parse(mdContent);

/* output
{
    "Heading 1": {
        raw: "This is a para\n - This is a list\n",
        "Heading 2": {
            raw: "This is a para\n"
        }
    }
}
*/

```

### Converting JSON to MD string

The method `toMd` can be used to convert the JSON Object to Markdown string.

```js

var md2json = require('md-2-json');
var json = {
    "Heading 1": {
        raw: "This is a para\n",
    }
}

md2json.toMd(json);

/* output
`
# Heading 1

This is a para

`
*/

```

---
_Source: https://npm.io/package/md-2-json · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
