JSON
Use JSON resources for extension features like rulesets and managed schemas with validation and predictable output handling.
Extension.js processes manifest-referenced JSON resources, validates them for known feature types, watches them during development, and emits output assets when needed.
JSON capabilities
JSON support
Common manifest fields:
Sample JSON declaration in manifest.json
Here's an example of how to declare a JSON file in your manifest.json:
Output path
JSON resources are emitted by feature context (for example DNR and storage schema outputs):
Development behavior
- Manifest-referenced JSON files are tracked as file dependencies.
- JSON edits trigger recompilation.
- Some JSON-related structural manifest changes can require restart diagnostics.
Validation behavior
Extension.js validates:
- JSON syntax for referenced resources
- DNR ruleset shape (array-based ruleset expectations)
- managed storage schema shape (object-based expectations)
Environment placeholders
Emitted .json assets can receive $EXTENSION_* placeholder replacement during compilation (same pass used for static HTML placeholder replacement).
Best practices
- Keep manifest-referenced JSON focused on browser-required resource formats.
- Validate JSON resources in CI before packaging.
- Prefer stable file paths in manifest to reduce restart-required structural changes in development.
- For app data consumed by code, consider JSON imports in JS/TS modules separately from manifest resource JSON.
Next steps
- Continue with icons in development.
- Learn about manifest development behavior.
