The example
The JSON above is the example. Explore it in the Tree tab, press Download to save it as a .json file, or Share to send someone a link to it. All names, ids, emails and values are invented.
Fields explained
| Path | Type | Notes |
|---|---|---|
server | object | Where and how the service listens. |
database | object | Connection settings. Passwords are deliberately not stored here. |
logging.level | string | One of a fixed set such as debug, info, warn or error. |
features | object of booleans | Feature flags that switch behaviour without a deploy. |
cors.allowedOrigins | array of strings | An allow-list of browser origins. |
Read it in code
JavaScript:
const config = JSON.parse(fs.readFileSync("config.json", "utf8"));
server.listen(config.server.port, config.server.host);Python:
config = json.load(open("config.json"))
port = config["server"]["port"]What this example is good for
- A template for your own service configuration
- Validating configuration with a JSON Schema before deploying
- Converting to YAML for tools that prefer it
Tips
- Keep secrets (passwords, API keys) in environment variables or a secret manager, not in a JSON file in your repository.
- Validate the file at startup so a typo fails fast instead of in production.
Convert this example
Open it in a converter, then switch the output in the Code tab:
- JSON to TypeScript
- JSON to Zod
- JSON to Python (Pydantic)
- JSON to Go
- JSON to JSON Schema
- JSON to CSV
- JSON to YAML
- JSON to XML