Serialization

For some of our datatypes we provide a way to save them in and load them from JSON format. This is still experimental and it will take some time until all corners of OSCAR are covered by this effort. The goal of this effort is threefold:

  • Avoid recomputation by providing an easy way to store data.
  • Increase portability by giving a convenient possibility to transport data.
  • Increase overall software quality by testing against existing data and tracking errors through data computed by different versions.
saveFunction
save(io::IO, obj::Any)
save(filename::String, obj::Any)

Save an object T to the given io stream respectively to the file filename.

See load.

Examples

julia> save("/tmp/fourtitwo.json", 42);

julia> load("/tmp/fourtitwo.json")
42
source
loadFunction
load(io::IO)
load(filename::String)

Load the object stored in the given io stream respectively in the file filename.

See save.

Examples

julia> save("/tmp/fourtitwo.json", 42);

julia> load("/tmp/fourtitwo.json")
42
source
load(io::IO, ::Type)
load(filename::String, T::Type)

Load the object of the given type stored in the given io stream respectively in the file filename.

This guarantees that the end result has the given type.

See save.

Examples

julia> save("/tmp/fourtitwo.json", 42);

julia> load("/tmp/fourtitwo.json")
42

julia> load("/tmp/fourtitwo.json", String)
ERROR: Type in file doesn't match target type: Base.Int not a subtype of String
source