russolsen/transit

Support encoding/decoding structs to/from map

Opened this issue · 0 comments

I'm sorry if this is already supported, but I couldn't see that from the docs.

Essentially, I want to code some arbitrary data to a transit map, without writing an encoder for it.

type Person struct {
    Name string
    Age int
}

encoded, err := transit.Marshall(&{"Robin", 28})
encoded == "["^ ","Name","Robin","Age",28]"

person := &Person{}
transit.Unmarshall(encoded, &person)