After considering your issue, I have come up with three potential solutions:
Utilizing Abstract Syntax Tree Parser and Visitor
One approach to tackling your problem is by employing an abstract syntax tree parser along with a visitor to automate the process of scanning and documenting the code.
The following resources may prove beneficial:
-
-What is JavaScript AST, how to play with it?
This method typically involves using a parser to obtain a tree structure, followed by utilizing a visitor to traverse all nodes and perform necessary tasks.
You will essentially create a tree representation of the specific library and then proceed to encode this in the desired 'def' format as referenced.
Implementing a Documentation Generator and Customizing Output
Another option is to download the source code of a documentation generator such as https://github.com/yui/yuidoc/
By making modifications to the styling and output format, you can produce "documentation" in the required JSON structure.
Transforming Existing Documentation (HTML doc) into JSON
You could develop a parser that takes a standard documentation format (similar to Javadoc for Java) and craft a converter to extract pertinent details and save them in a JSON definition.