$devtoolkit.sh/examples/json/config-file

Format an App Config JSON File

Application configuration stored in JSON needs to be readable, consistent, and error-free. This example shows a typical app config with feature flags, database settings, and third-party service endpoints. Formatting makes it easy to review config changes in pull requests and catch typos in environment values. Validating JSON syntax before deploying prevents runtime crashes from malformed config.

Example
{
  "app": { "name": "MyApp", "version": "2.1.0", "environment": "production" },
  "features": {
    "darkMode": true,
    "betaDashboard": false,
    "newOnboarding": true
  },
  "database": {
    "host": "db.example.com",
    "port": 5432,
    "name": "myapp_prod"
  },
  "services": {
    "emailProvider": "sendgrid",
    "analyticsEnabled": true
  }
}
[ open in JSON Formatter → ]

FAQ

Should I store secrets in JSON config files?
No. Passwords, API keys, and tokens should live in environment variables or a secrets manager, not in config files that are often committed to version control.
What is feature flagging in config?
Feature flags are boolean values in config that enable or disable features without code deploys, making it safe to roll out changes gradually or roll back instantly.
Can I use environment-specific config files?
Yes. A common pattern is to have config.json, config.staging.json, and config.production.json, merging the appropriate file at startup based on the NODE_ENV variable.

Related Examples

/examples/json/config-filev1.0.0