[PP-1] Support default content in JSON format

Created on 28 June 2025, 7 days ago

Problem/Motivation

When ✨ Add a command-line utility to export content in YAML format Active is committed, core will be able to export default content as YAML.

Since YAML is a superset of JSON, it would be trivial to also allow the export to be done as JSON. The default content importer would need practically zero changes (it would just have to scan for .json files in addition to .yml), and the exporter could use an injected SerializationInterface class for the same purpose. The content:export command could receive an optional --format option to specify either yaml or json as the output format (it would continue to default to YAML). This would all be trivial to implement.

JSON makes sense for default content because the only real advantage of YAML is that it is more human-readable and supports comments. For many things in core, those are very strong advantages. But for default content, which is (more or less) a dump of raw field values? Not so much.

JSON is also the clear winner for interoperability -- PHP supports it natively, whereas you either need a PECL extension or a Symfony component to read YAML. Parsing JSON is also faster, I believe, than parsing YAML. Given how easy this would be to support, I don't think it hurts anything to allow default content to be exported as JSON.

✨ Feature request
Status

Postponed

Version

11.0 πŸ”₯

Component

default content system

Created by

πŸ‡ΊπŸ‡ΈUnited States phenaproxima Massachusetts

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024