Serialization

21 projects

Serialization libraries turn Go values into bytes for storage or transport and back again. The standard library already includes encoding/json, encoding/xml, encoding/csv, encoding/binary and encoding/gob, a Go-specific binary format that is convenient between Go programs. This category adds cross-language binary formats, schema-driven code generation, faster JSON encoders and helpers for CSV and fixed-width files.

Protocol Buffers is the most common schema-based format; golang/protobuf holds the original Go API, which now wraps google.golang.org/protobuf, the module new code should import. ugorji's go-codec handles MessagePack, CBOR, JSON and more through one API, and fxamacker/cbor is a CBOR library that puts emphasis on safe decoding of untrusted input. jszwec/csvutil maps CSV rows to structs. colfer, Cap'n Proto bindings and mus-go are less common binary formats. json-iterator/go was long used as a faster drop-in for encoding/json but is now archived, so avoid it in new code.

Pick the format first, based on who reads the data: JSON for public APIs, Protocol Buffers when you also use gRPC or need schemas shared across languages, CBOR or MessagePack for compact self-describing messages. Use gob only between Go programs you control. For JSON speed, measure the standard library before switching, and consider the experimental encoding/json/v2.

jsoniterby json-iterator

High-performance 100% compatible drop-in replacement of "encoding/json".

v1.1.12archived

13.9k

goprotobufby golang

Go support, in the form of a library and protocol compiler plugin, for Google's protocol buffers.

github.com/golang/protobufGo 1.17+ 2 dependenciesv1.5.4updated 1mo ago

10.1k

go-codecby ugorji

High Performance, feature-Rich, idiomatic encode, decode and rpc library for msgpack, cbor and json, with runtime-based OR code-generation support.

codec/v1.3.2updated 2mo ago

2k

cborby fxamacker

Small, safe, and easy CBOR encoding and decoding library.

github.com/fxamacker/cbor/v2Go 1.24+ 1 dependencyv2.10.0updated today

1.1k

csvutilby jszwec

High Performance, idiomatic CSV record encoding and decoding to native Go structures.

github.com/jszwec/csvutilGo 1.18+ No dependencies v1.10.1updated 9d ago

1k

colferby pascaldekloe

Code generation for the Colfer binary format.

github.com/pascaldekloe/colferGo 1.18+ 4 dependenciesv1.8.1updated 8mo ago

760

protoby emicklei

Parser and writer for Google ProtocolBuffers.proto files.

github.com/emicklei/protoGo 1.12+ No dependencies updated 2mo ago

615

go-capnprotoby glycerine

Cap'n Proto library and parser for go.

updated 6y ago

286

php_session_decoderby yvasiyarov

GoLang library for working with PHP session format and PHP Serialize/Unserialize functions.

updated 8y ago

170

mus-goby mus-format

MUS format serializer for Go.

github.com/mus-format/mus-goGo 1.24+ 4 dependenciesv0.10.2updated 5mo ago

145

structomapby tuvistavie

Library to easily and dynamically generate maps from static structures.

updated 7y ago

144

binstructby ghostiam

Golang binary decoder for mapping data into the structure.

github.com/ghostiam/binstructGo 1.21+ 2 dependenciesv1.4.0updated 2y ago

114

bambamby glycerine

Generator for Cap'n Proto schemas from go.

updated 10y ago

64

belby 32leaves

Generate TypeScript interfaces from Go structs/interfaces. Useful for JSON RPC.

github.com/32leaves/belGo 1.12+ 3 dependenciesupdated 2y ago

46

fwencoderby o1egl

Fixed width file parser (encoding and decoding library) for Go.

github.com/o1egl/fwencoderGo 1.23+ 1 dependencyupdated 1y ago

27

elasticby epiclabs-io

Convert slices, maps or any other unknown value across different types at run-time, no matter what.

github.com/epiclabs-io/elasticGo 1.13+ 1 dependencyupdated 5y ago

25

gotinyby raszia

Efficient Go serialization library, gotiny is almost as fast as serialization libraries that generate code.

github.com/raszia/gotinyGo 1.19+ 1 dependencyv0.1.1updated 2y ago

21

pletterby vimeda

A standard way to wrap a proto message for message brokers.

github.com/vimeda/pletterGo 1.17+ 2 dependenciesv1.2.1updated 10mo ago

20

go-csvlibby tiendc

High level and rich functionalities CSV serialization/deserialization library.

github.com/tiendc/go-csvlibGo 1.18+ 3 dependenciesv1.0.0updated 2y ago

18

fixedwidthby huydang284

Fixed-width text formatting (UTF-8 supported).

github.com/huydang284/fixedwidthGo 1.12+ 1 dependencyv1.0.1updated 2mo ago

9

unitpackingby recolude

Library to pack unit vectors into as fewest bytes as possible.

github.com/recolude/unitpackingGo 1.15+ 3 dependenciesv1.0.0updated 3y ago

7
Esc

Type to search every entry. ↑↓ to move, Enter to open.