Skip to content

Easy way to convert dict to struct

License

Notifications You must be signed in to change notification settings

yubessy/ToStruct.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ToStruct.jl

Easy way to convert dict to struct

Installation

using Pkg
Pkg.add("ToStruct)

Usage

using ToStruct

struct Foo
    i::Int
    s::String
end

struct Bar
    foo::Foo
end

x = Dict("foo" => Dict("i" => 1, "s" => "hello"))
ToStruct.tostruct(Bar, x) == Bar(Foo(1, "hello")) # true