Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

212
Views
Any standard way to export structured js/json from jsdoc comments

I want to use jsdoc comments from a javascript file inside an interactive component (like property definitions appearing on hover), but I can’t find a way to do that as jsdoc is primarily intended to export html files.

Is there a straightforward way to parse jsdoc comments from a file as structured data that I can then consume in my UI?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

[…]as jsdoc is primarily intended to export html files.

Probably the most common use case but definitely not the only one.

I personally never use JSDoc itself to generate documentation. I use the -X option then jq to transform the parse tree.

Example: index.js

/**
 * The answer to everything
 * @return {number}
 */
function asnwer() {
  return 42;
}
npx jsdoc -X index.js
[
    {
        "comment": "/**\n * The answer to everything\n * @return {number}\n */",
        "meta": {
            "range": [
                56,
                90
            ],
            "filename": "index.js",
            "lineno": 5,
            "columnno": 0,
            "path": "/workspaces/dev",
            "code": {
                "id": "astnode100000002",
                "name": "asnwer",
                "type": "FunctionDeclaration",
                "paramnames": []
            }
        },
        "description": "The answer to everything",
        "returns": [
            {
                "type": {
                    "names": [
                        "number"
                    ]
                }
            }
        ],
        "name": "asnwer",
        "longname": "asnwer",
        "kind": "function",
        "scope": "global",
        "params": []
    },
    {
        "kind": "package",
        "longname": "package:undefined",
        "files": [
            "/workspaces/dev/index.js"
        ]
    }
]
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!