How to specific a dictionary for a TOML file in Julia?

Viewed 895

if I want to have a dictionary for entries in a TOML file, how can I set that up in Julia?

I want it to be something like:

["hello"]
world = Dict("z" => 25, "c" => 1)
2 Answers

Currently you can also use TOML module built into Pkg module without installing anything:

julia> using Pkg

julia> Pkg.TOML.print(Dict("hello" => Dict("world" => Dict("hellow" => "wurld"))))

[hello.world]
hellow = "wurld"

You can quite simply use TOML by doing the following:

add https://github.com/JuliaLang/TOML.jl.git in the package manager.

import TOML

TOML.print(Dict("hello" => Dict("world" => Dict("hellow" => "wurld"))))

which will output:

[hello.world]
hellow = "wurld"

See the TOML.jl for more info.

Related