On Ubuntu 24.04 in case you need to convert a .toml into a .json the best way is to install tomljson provided by the golang-github-pelletier-go-toml package instead of the more straightforward toml2json. The latter is just a python script provided by the reserialize package with lot of bugs.
On later version I suggest rust-toml2json via apt.