Markdown to JSON
Turn Markdown into a JSON tree of headings, paragraphs, lists, links and code blocks.
Results are provided as is, for general information. Check anything important before relying on it. See the Terms of Use.
About Markdown to JSON
Parses Markdown into a JSON tree. The root holds typed nodes: headings with their depth, paragraphs, emphasis and strong text, links and images with their URL and title, ordered, bullet and task lists (nested items included), tables with column alignment, blockquotes, thematic breaks, and fenced code with its language. Raw HTML in the Markdown is carried as a string value and is never rendered. Node names follow mdast, the tree format used by the remark ecosystem, so the output looks familiar, but the parsing is done by marked, not remark: edge cases such as unusual nesting or HTML blocks can differ, and character references like & are left as typed. Turn on raw to attach the original Markdown to every node, or switch off pretty-printing for one compact line. Input is limited to 1,000,000 characters. Everything runs in your browser; your Markdown is never uploaded.
When to use Markdown to JSON
Markdown to JSON FAQ
Is my Markdown uploaded anywhere?
No. The Markdown is parsed in your browser and nothing is sent to a server.
Is this the same as mdast or remark output?
Close, not identical. The node and field names follow mdast (heading, listItem, inlineCode, thematicBreak, definition), but the tree is built from the marked parser. Positions are not included, and a few cases, such as how adjacent HTML is split into nodes, can differ from remark. If you need byte-exact remark output, run remark in your own project.
What does Include the original Markdown as raw do?
It adds a raw field to each block and inline node holding the exact Markdown text it came from, which helps when you need to map a node back to the source. It makes the JSON much larger.
Is raw HTML in the Markdown run?
No. An HTML block or tag becomes a node of type html whose value is the text as written. Nothing is rendered or executed here.
Which Markdown flavour does it read?
CommonMark with GitHub Flavored Markdown additions: tables, task lists, strikethrough and autolinks.
How is this different from Markdown Preview?
Markdown Preview shows the rendered page for a human to read. This gives the underlying structure as JSON for a program to read.
Sources
- CommonMark specification
- GitHub Flavored Markdown specification
- mdast: Markdown Abstract Syntax Tree format