DARINORCold Lab

Tools / Markdown to JSON

Markdown to JSON

Parse Markdown into a structured JSON tree (an mdast AST) right in your browser — headings, lists, and code blocks as typed nodes, not just rendered HTML. Nothing is uploaded.

JSON (mdast)

147 lines · 3174 characters

// About this tool

Markdown to JSON

This tool parses Markdown into an mdast (Markdown Abstract Syntax Tree) and shows it as JSON, entirely in your browser. Instead of rendered HTML, you get a structured tree of typed nodes — headings with their depth, list items, code blocks with their language, links with their URL — that's easy to walk programmatically.

Toggle source positions on to include the line, column, and character offset of every node, which is useful when you need to map a node back to its original location in the file.

Everything runs locally — your Markdown is never uploaded, which makes it safe to use on drafts, internal docs, or content pulled from another tool.

// When to use it

  • Feed structured content to a script or agent

    Get typed nodes instead of scraping rendered HTML when a program needs to walk a document's structure.

  • Inspect how a Markdown feature parses

    See exactly how a nested list, a link reference, or a fenced code block becomes AST nodes.

  • Debug a Markdown-processing pipeline

    Check the tree your content produces before it's handed off to a renderer or transform step.

// Questions

Is my Markdown uploaded to a server?

No. Parsing happens entirely in your browser via the mdast-util-from-markdown library. Nothing is sent anywhere.

What is mdast?

mdast (Markdown Abstract Syntax Tree) is a standard spec for representing Markdown as a tree of typed nodes — the same format used by the remark/unified ecosystem. It's more structured than an HTML string, which makes it easier to process programmatically.

Why would I use this instead of the Markdown Preview tool?

Markdown Preview renders Markdown to HTML for reading. This tool outputs the underlying structure as JSON, which is what you want when a program — not a human — needs to consume the content.

What does "Include source positions" do?

It adds a position object to every node with its start/end line, column, and character offset in the original Markdown, useful for mapping AST nodes back to source locations.

This site uses minimal cookies and local storage to keep features like the chat widget and games working. We do not use third-party tracking cookies. Privacy Policy