ToStruct.jl

Easy way to convert dict to struct
Author yubessy
Popularity
6 Stars
Updated Last
1 Year Ago
Started In
January 2019

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