Convert i18n/*.toml -> *.json

Hello

in my i18n/ folder i have TOML files for all supported languages …
i want to change permanently to json files - i need a script or a bash command to convert toml->josn
thanks for the help

rob

PS when i deleted *.toml then Hugo automatically takes *.json or do i have to config that somewhere?

This is not a forum for bash script file conversions.
Please search the UNIX / Linux forums and/or StackOverflow.

Hugo config can be in toml, json or yaml. If you provide a json it should be picked up without doing anything.

  1. ok - I thought other here might have had someone the same problem or Hugo has somewhere a hidden function
  2. Thanks
    cu rob

Hugo has the CLI command hugo convert that is meant for converting the front matter format of content files.

You may try and see if it suits your use case, however you would still need to change the file extension to JSON manually.

1 Like
1 Like

If you need to convert more than one or two files (e.g., an i18n directory with 20 toml files), you might consider https://github.com/sclevine/yj.

2 Likes

This topic was automatically closed after 19 hours. New replies are no longer allowed.