# How to convert TOML file into a Structure and vice versa?

**URL:** https://discourse.julialang.org/t/how-to-convert-toml-file-into-a-structure-and-vice-versa/61265
**Category:** Data
**Tags:** data, data\_structures, structure, toml
**Created:** [May 16, 2021, 10:56pm UTC](https://discourse.julialang.org/t/how-to-convert-toml-file-into-a-structure-and-vice-versa/61265 "2021-05-16T22:56:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![JosephPollacco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/josephpollacco/32/51404_2.png) [@JosephPollacco](https://discourse.julialang.org/u/JosephPollacco)
#### Post date: [May 16, 2021, 10:56pm UTC](https://discourse.julialang.org/t/how-to-convert-toml-file-into-a-structure-and-vice-versa/61265/1 "2021-05-16T22:56:54Z")

</div>

Hi I have a large SoilWater-ToolBox model and I have got all the input , [Parameters](https://github.com/manaakiwhenua/SoilWater_ToolBox/blob/master/src/Param.jl), as a **mutable struct**. In order to create a package I will need to read the parameters outside the model as recommended in previous post as a TOML.

> So the question is how to convert the structure into **TOML**?  
> Then how to read **TOML** file into a **structure**?

**I will be delighted if one can provide me guidance how to perform this task by using the proposed simple structure:**

```julia
mutable struct OPTION
   transpiration
   soil 
end

   mutable struct TRANSPIRATION
      Evaporation :: Bool
      Transpiration :: Bool
   end

   mutable struct SOIL
      Topsoil :: Bool
      Macropore :: Bool
   end

Evaporation = true
Transpiration = false
   transpiration = TRANSPIRATION(Evaporation, Transpiration)

   Topsoil = true
   Macropore = false
soil = SOIL(Topsoil, Macropore)

option = OPTION(transpiration, soil)

```

---

<div class="post-metadata">

### Author: ![jzr](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@jzr](https://discourse.julialang.org/u/jzr)
#### Post date: [May 16, 2021, 11:22pm UTC](https://discourse.julialang.org/t/how-to-convert-toml-file-into-a-structure-and-vice-versa/61265/2 "2021-05-16T23:22:14Z")

</div>

I think that’s what [Home · StructTypes.jl](https://juliadata.github.io/StructTypes.jl/stable/) is for.
