/BSONSerializer.jl

Encode/Decode your Julia structures to/from BSON.

Primary LanguageJuliaMIT LicenseMIT

BSONSerializer.jl

License travis codecov

Encode/Decode your Julia structures to/from BSON.

Requirements

  • Julia v1.1

Usage

using BSONSerializer

struct MyType
    str::String
    num::Int
end

# this macro will generate
# serialize/deserialize code
@BSONSerializable(MyType)

instance = MyType("hey", 101)
bson = BSONSerializer.serialize(instance)
println(bson)

new_instance = BSONSerializer.deserialize(bson)
@assert new_instance == instance

Generated BSON:

{
  "type": "MyType",
  "args": {
    "str": "hey",
    "num": 101
  }
}

Alternative Packages