Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Content & Markdown

Converting json to yaml

Started by Mike 9 years ago · 0 replies · 804 views
9 years ago

I am using the import plugin to import json files into markdown content.

To achieve this I am using code such as:

TWIG
{{ page.header.imports.ex_config|json_encode(constant('JSON_PRETTY_PRINT') b-or constant('JSON_UNESCAPED_SLASHES'))|e('html') }}

Is it possible to convert this into yaml content? Each json file I am importing needs to have a yaml equivalent, but I don't want to have to maintain both files, so it would be good to be able to single source from one json file which can be converted to yaml within the markdown (or 1 yaml file which is converted to json)

Suggested topics

Topic Participants Replies Views Activity
Content & Markdown · by Jochen, 8 months ago
6 94 8 months ago
Content & Markdown · by Ton Haarmans, 1 year ago
10 184 1 year ago
Content & Markdown · by Jan L'Am, 1 year ago
4 146 1 year ago
Content & Markdown · by Leonardo, 1 year ago
3 60 1 year ago
Content & Markdown · by belthasar, 1 year ago
4 254 1 year ago