How to save and read a structure?

BSON.jl is a Julia package for working with the Binary JSON serialisation format. It can be used as a general store for Julia data structures, with the following features:

Lightweight and ubiquitous, with a simple JSON-like data model and clients in many languages.
Efficient for binary data (eg. arrays of floats).
Flexible enough to handle anything you throw at it – closures, custom types, circular data structures, etc.
Backwards compatible, so that if data layout changes old files will still load.

3 Likes

It seems to load fine

... # Your code to save

julia> load("My_file.jld2")
Dict{String, Any} with 1 entry:
  "CP" => S[S(["3d4f7006", "3d4f7006"], [2.0, 3.0]), S(["3d5ce1ef", "3d5ce1ef"], [7.0, 8.0])]

julia> ans["CP"]
2-element Vector{S}:
 S(["3d4f7006", "3d4f7006"], [2.0, 3.0])
 S(["3d5ce1ef", "3d5ce1ef"], [7.0, 8.0])