Simply flag any object within the definition with an x-internal specification extension, and it will be removed from the output. Works with OpenAPI/Swagger 2.0 and 3.0.x and AsyncAPI definitions.
JSONC is JSON with JavaScript style comments. This node module provides a scanner and fault tolerant parser that can process JSONC but is also useful for standard JSON.