docc2json is a fast Go CLI tool that converts Apple's DocC documentation output into a clean, structured JSON schema optimized for web documentation sites and SDKs. It belongs to the developer tools category, specifically targeting iOS and macOS developers who build documentation sites or maintain SDKs for their libraries. The core value lies in transforming the complex, file-heavy DocC archive—which can contain thousands of small JSON files—into a single deployable JSON file easily consumed by custom frontends. By parsing the DocC JSON output generated during documentation builds, docc2json eliminates manual extraction and reformatting, providing an API-deployable structure for websites, IDE plugins, and automated documentation pipelines. This tool bridges the gap between Apple's documentation format and modern web-based presentation, making SDK documentation accessible without proprietary hosting.
The primary pain point docc2json solves is the difficulty of using Apple's native DocC documentation format for web deployment. While DocC generates rich documentation within Xcode, the output consists of numerous deeply nested JSON files with inconsistent naming and internal cross-references that are challenging to parse externally. Developers building custom documentation portals, cross-platform SDK references, or integrating documentation into existing websites often find themselves writing complex scripts to extract and reorganize this data. This problem is especially acute for SDK publishers who need to deliver consistent documentation across multiple platforms or for teams using static site generators. docc2json addresses this by providing a straightforward CLI approach that processes the entire DocC archive and outputs a unified, well-structured JSON file ready for immediate use.
docc2json's core parsing capabilities include comprehensive documentation extraction from DocC JSON files. It reads DocC archives (.doccarchive) or processed documentation folders, parallelizing the processing using Go goroutines for speed. The tool extracts abstracts, discussions, examples, and code listings from DocC comments, preserving the full richness of the original documentation. A notable feature is filtering by access level using the --public-only flag, which lets SDK authors generate a public API schema by excluding internal and private symbols. Additionally, the tool supports rich metadata extraction including parameters, return types, and async/throws modifiers, ensuring that the structured output retains all the technical details developers need. This automatic extraction reduces the effort required to create an API reference from hours of manual work to a single command.
admin
Another major feature group is the intelligent processing of protocol conformances. docc2json automatically unmangles Swift protocol names, converting cryptic identifiers like `s8SendableP` into readable names such as `Sendable`. It also includes smart conformance filtering that removes standard library protocols (e.g., Equatable, Hashable, Codable) from output by default, keeping only custom and third-party protocols relevant to the user's SDK. This eliminates clutter and focuses documentation on what is unique to the project. Users can customize this filtering further using the --filter-protocols flag to exclude additional protocols, or use --keep-all-conformances for debugging. The combination of automatic unmangling and smart filtering significantly cleans up the output schema, making it more useful for documentation sites that highlight custom protocol adoptions without noise from ubiquitous system protocols.
docc2json provides flexible type grouping to organize documentation for better readability. Automatic prefix-based grouping (--group-by-prefix) clusters types by their name prefixes (e.g., Wish, WishStatus, WishFilters into a Wish group), creating logical sections. For more control, a YAML configuration file can define custom groups with explicit type lists, patterns using wildcards, and group descriptions. The output schema includes modules containing types, protocols, and enums, each with full documentation, methods, properties, and conformances. Additionally, a navigation structure is generated for easy website integration. Beyond JSON output, the tool includes a json2docs subcommand that converts generated JSON into Markdown or MDX files, suitable for static site generators like Docusaurus or Next.js, with optional YAML frontmatter.
The tool's workflow follows a structured pipeline. First, file walking locates all JSON files in the DocC output directory. These files are then parsed concurrently using goroutines, which dramatically reduces processing time for large archives. Next, token reconstruction rebuilds method signatures from DocC's internal token arrays, and reference resolution resolves cross-references between symbols. Access filtering then removes symbols based on the chosen access level. The core transformation step converts the DocC schema into a custom SDK schema, mapping types, methods, properties, and documentation into a consistent format. Finally, the result is written to a formatted JSON file. The architecture separates concerns into packages for parsing, transformation, filtering, and writing, making the tool maintainable and extensible for future DocC schema versions.
docc2json enables several concrete scenarios. For documentation websites, developers can generate a complete JSON snapshot of an iOS SDK and wire it into a custom frontend or static site, providing searchable API references. IDE integration becomes straightforward: plugins can consume the JSON to offer autocomplete and inline documentation within editors. SDK analysis tasks, such as programmatically checking API surface changes or generating changelogs, are simplified by having a structured data source. Cross-platform documentation can be unified by converting DocC output into files suitable for Markdown-based documentation systems. The primary outcome is a dramatic reduction in time spent on documentation maintenance—from hours of scripting to seconds of CLI execution—while preserving documentation accuracy and enhancing discoverability for end users.
docc2json is built for iOS and macOS developers, SDK authors, and documentation engineers who use Apple's DocC for their library documentation. It runs on macOS and Linux and requires Go 1.21 or higher. The tool is open source under the MIT license, and installation is available via prebuilt binaries for Apple Silicon or building from source. It is tested with Swift 5.9+ DocC output, including large SDKs with tens of thousands of files. In summary, docc2json provides a direct path from Xcode's DocC to web-ready JSON, delivering a clean, structured, and deployable format that empowers teams to present their SDK documentation exactly how they want, without manual reformatting or reliance on proprietary hosting.
iOS SDK developers, documentation engineers, technical writers maintaining API references, DevOps teams automating documentation builds, Swift library maintainers, and teams building custom developer portals for their mobile or macOS frameworks. Specifically suited for those who work with Xcode's DocC to produce documentation and need a reliable way to make it available on the web, in IDEs, or across platforms without manual scripting. Also valuable for open-source project maintainers who want to publish polished documentation for their Swift packages.