Can Canton configuration files be in JSON format?
App Development3 posts98 views2 likesLast activity May 2024
WA
WallaceKellyOP
May 2024The 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?
WA
WallaceKelly
May 2024Apparently 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.status
docker run -it --rm \
--volume ./:/host/ \
digitalasset/canton-open-source:2.7.9 \
--config /host/canton.json
participants.local.head.health.status
This could be helpful for script-based creation and editing of configuration files. There is simply more JSON-aware tooling available (e.g., jq).
GA
Gary_Verhaegen
May 2024It is a property of HOCON that any valid JSON file is also a valid HOCON file.