- Issue created by @phenaproxima
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.
Postponed
11.0 π₯
default content system