docc2json is a Go-based command-line tool designed specifically for processing Apple's DocC documentation output. It takes the JSON files generated by Xcode's DocC compiler and transforms them into a clean, structured schema that's optimized for web deployment and SDK integration. The tool addresses the limitation that DocC documentation works well within Xcode but is difficult to reuse elsewhere.
The tool offers comprehensive documentation extraction including abstracts, discussions, examples, and code listings from DocC comments. It provides rich metadata extraction covering parameters, return types, and async/throws modifiers. Protocol conformance handling includes automatic unmangling of Swift protocol names and smart filtering of standard library protocols. Flexible grouping options allow organizing types by prefix or custom configuration, and the tool supports including documentation articles and tutorials.
The conversion process works through several stages: file walking to locate JSON files, parallel parsing using goroutines, token reconstruction from DocC's token arrays, reference resolution between symbols, access level filtering, transformation to custom SDK schema, and JSON output generation. This architecture ensures efficient processing even with large documentation sets.
Benefits include enabling custom documentation websites, providing IDE integration capabilities, supporting SDK analysis, and generating cross-platform documentation. The tool has been tested with AppGramSDK documentation containing 38,618 files and 129 symbols plus 92 articles, demonstrating performance of under 1 second for parsing and transformation.
The primary users are iOS and macOS developers who need to publish their SDK documentation online, documentation engineers creating custom documentation sites, and teams requiring programmatic access to their SDK structure. It integrates with existing DocC workflows and generates output suitable for web hosting and API deployment.
admin
The tool is designed for iOS and macOS developers who need to publish their SDK documentation online, documentation engineers creating custom documentation sites, and development teams requiring programmatic access to their SDK structure. It serves organizations using Apple's DocC system who want to extend their documentation beyond Xcode's native capabilities.