Can Canton configuration files be in JSON format?
- WallaceKellyOP
The typical Canton example has the configuration files in HOCON format. That is really nice for human readability and editability.
Does Canton also accept configuration files in JSON format?
- WallaceKelly 1
Apparently so. I converted a HOCON configuration file into a JSON file using this CLI tool.
HOCON Example
canton { participants { mynode { ledger-api.address=localhost } } }Equivalent JSON
hoconvert --file canton.conf --output json > canton.json{ "canton": { "participants": { "mynode": { "ledger-api": { "address": "localhost" } } } } }Canton accepted both HOCON and JSON files without error:
docker run -it --rm \ --volume ./:/host/ \ digitalasset/canton-open-source:2.7.9 \ --config /host/canton.conf participants.local.head.health.statusdocker run -it --rm \ --volume ./:/host/ \ digitalasset/canton-open-source:2.7.9 \ --config /host/canton.json participants.local.head.health.statusThis could be helpful for script-based creation and editing of configuration files. There is simply more JSON-aware tooling available (e.g.,
jq). - Gary_Verhaegen 1
It is a property of HOCON that any valid JSON file is also a valid HOCON file.