diff --git a/src/SyntacticModels.jl b/src/SyntacticModels.jl index 7b8f02f..12d9290 100644 --- a/src/SyntacticModels.jl +++ b/src/SyntacticModels.jl @@ -51,7 +51,9 @@ include("composite_models.jl") #-----------------------------------------------------------------------------# Constructors for T in concrete_subtypes(AbstractTerm) @eval function $(parentmodule(T)).$(T.name.name)(x::NamedTuple) - args = x[fieldnames($T)] + fields = filter(x -> x != :_type, fieldnames($T)) + args = collect(x[fields]) + @show args $(parentmodule(T)).$(T.name.name)(args...) end end diff --git a/test/core.jl b/test/core.jl index 55f9996..600eaf5 100644 --- a/test/core.jl +++ b/test/core.jl @@ -9,7 +9,7 @@ using JSON3 jsondir = joinpath(@__DIR__, "json") write_json_model(m, prefix=joinpath(@__DIR__, "json")) = open(joinpath(prefix, "$(m.header.name).json"), "w") do fp - JSON3.pretty(fp, Dict(m)) + JSON3.pretty(fp, m) end readback(m, prefix=joinpath(@__DIR__, "json")) = open(joinpath(jsondir, "$(m.header.name).json"), "r") do fp