Closed koehlerson closed 8 months ago
Hi @koehlerson,
I will admit, that this is not obvious but with https://juliaio.github.io/JLD2.jl/dev/advanced/
you can do
julia> load("blah.jld2"; typemap=Dict("Main.Foo"=>JLD2.Upgrade(NamedTuple)))
Dict{String, Any} with 1 entry:
"test" => (x = 1, z = 2.0)
Thanks for the hint!
Let's say I have a struct called
Foo
and I save one instance to diskif I close the session, open a new one and slightly redefine the type by only adding a parametrization (even though the data needed to reconstruct is still there) I cannot read the data in the form of
x
andz
valuesIs there a way such that I don't remap the stored data to
Foo
but instead just read the plain data, i.e.x
andz
in this case? Basically, what I want is HDF5.jl behavior as a possible option:If I open the file with
HDF5
it works as I intend:but I think it would be nice to have the optional type remapping when reading a file with JLD2. I know that an explicit type remapping is possible as well as doing a custom serialization, but as far as I know the custom serialization option always remaps to a composite type back and I have some use cases where I don't want this all the time, but instead I'm okay to look at
(x=1,z=2.0)
.