Custom module with config exposed in json api
You can't do it. Not with the core JSON:API module. Out of the box, the resources JSON:API exposes are all the entity definitions from EntityTypeManager which includes content &amp; config entities (defined by extending ConfigEntityBase).
However, arbitrarily set config values will not be exposed. JSON:API also doesn't support custom resources, as JSON:API docs state:

The JSON:API module provides no PHP API to modify its behavior. It
is designed to have zero configuration.
• Adding new resources/resource types is unsupported: all
entities/entity types are exposed automatically. If you want to expose
more data via the JSON:API module, the data must be defined as entity.
See the &quot;Resources&quot; section.

The JSON:API Resources project attempts to fill this in if you want to design your own endpoint with custom responses.