Custom formatters

To manage content with other file formats than the built in ones, you can register a custom formatter:

const JSON5 = require('json5');

CMS.registerCustomFormat('json5', 'json5', {
  fromFile: text => JSON5.parse(text),
  toFile: value => JSON5.stringify(value, null, 2),

Then include format: json5 in your collection configuration. See the Collection docs for more details.

You can also override the in-built formatters. For example, to change the YAML serialization method from yaml to js-yaml:

const jsYaml = require('js-yaml');

CMS.registerCustomFormat('yml', 'yml', {
  fromFile: text => jsYaml.load(text),
  toFile: value => jsYaml.dump(value),
Decap CMS

Maintained with care by PM TechHub and amazing contributors