Library / SDK
ugorji/go avatar
ugorji/go

ugorji/go: Go codecs for MessagePack, CBOR, JSON and RPC

idiomatic codec and rpc lib for msgpack, cbor, json, etc. msgpack.org[Go]

1,966 stars317 forksGoMIT

At a glance

What is it?
ugorji/go provides a Go module for encoding values as MessagePack, CBOR, JSON, BINC or simple format data. It suits Go 1.20+ services with several serialization needs, although the top-level README provides no complete API example.
Who is it for?
Go developers can adopt ugorji/go when one module must cover MessagePack, CBOR, JSON, BINC or simple encoding. Projects that need documented setup examples, explicit interoperability rules, an RPC quick start or clear migration procedures should first review `codec/README.md`, the module release notes, and the behavior of their required wire formats.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 51 days ago.
What is it written in?
Mainly Go, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 22, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What ugorji/go codec actually covers

ugorji/go addresses serialization in Go applications that need to encode and decode values across several formats. Its intended users are developers working with Go 1.20 or later who require MessagePack, CBOR, JSON, BINC or the library's simple format without managing a separate top-level repository for each choice. The README describes the project as an idiomatic Go codec and RPC library, while its format list shows that codec support is the most clearly documented part.

The formats fall into binary and text categories. MessagePack, CBOR and BINC are binary formats, while JSON and simple are presented as text formats. That distinction gives application designers an initial choice based on payload representation, but it does not establish compatibility or performance. The README does not provide output sizes, throughput figures, memory results, supported Go type lists, or interoperability examples.

The repository also contains `codecgen` and benchmarks for comparison with other libraries. A benchmark directory does not by itself prove a particular result, and the README gives neither benchmark commands nor recorded results. Engineers who expect `codecgen` to be mandatory for all applications, or who expect a guaranteed advantage over another codec, will not find support for either claim in the top-level documentation.

The repository name and Go import path are also not interchangeable. The repository is `ugorji/go`, but its single documented module is `github.com/ugorji/go/codec`. That distinction affects dependency declarations and should be preserved when adding the package.

Module layout and the codec boundary

The repository layout places the module under `codec/`, alongside a top-level README, FAQ, license and `codecgen` source context. The README explicitly says that the repository consists of one module: `github.com/ugorji/go/codec`. It then directs readers to `codec/README.md` for module-specific documentation and links to the package reference for that import path.

A codec normally forms the boundary between application values and serialized data. An encoder accepts a Go value and writes a representation in the selected format. A decoder reads that representation and produces a Go value. ugorji/go's documented format support places it at that boundary, but the top-level README does not name the encoder, decoder, interfaces, helper functions, or configuration types used in the API. Those names should be taken from `codec/README.md` or the package reference rather than inferred.

The README also states that the library supports generics and monomorphization based on build tags. This indicates that the implementation offers distinct paths within Go's build model. It does not list the build tags, explain when an application should select either path, or show whether generated code is required for common operations. The documented presence of `codecgen` makes code generation relevant, but the available project overview is not enough to describe its invocation or output safely.

Consequently, the architecture is clear at a high level but incomplete at the API level. Format selection and Go-value conversion are established project responsibilities. Exact construction, stream handling, error behavior, custom type hooks, and unknown-field policy require package-level documentation.

Installing the ugorji/go codec module

The README gives a direct command for adding the codec module to a Go application:

bash
go get github.com/ugorji/go/codec

After Go resolves and records the dependency, the module file for the application should list `github.com/ugorji/go/codec`. The README does not prescribe a version in this command, and it does not document a separate installation step for `codecgen`. It also provides no platform prerequisites, environment variables, container setup, or offline installation procedure.

The first usable API call cannot be shown from the top-level README because it does not include an encoding or decoding example. Writing one would require guessing package symbols or options. The README instead points users to `codec/README.md`, which is the documented next location for the actual API. A new user should look there for how to construct a codec, select MessagePack, CBOR, JSON, BINC or simple format, encode a value, and decode the result.

This is a concrete documentation weakness. Dependency installation is a single command, but the path from installation to a verified round trip is not demonstrated on the repository's main page. Teams adopting the module should not design their first integration until they have confirmed the documented API and observed the output they expect.

Format coverage without an interoperability contract

ugorji/go's clearest documented advantage is the range of formats offered through one module. An application could use MessagePack for a binary protocol, CBOR for another interface, or JSON where human-readable text is a requirement. BINC and simple are available as additional choices. The README does not show a shared configuration mechanism for changing formats, however, so it does not establish that one unchanged value-mapping layer works across every format.

Format support must not be confused with wire compatibility. CBOR and MessagePack allow applications to define conventions around tags, extensions, and data interpretation. JSON introduces choices involving field names, omitted values, number representation, and escaping. The README does not say whether generated output follows particular conventions, how `[]byte` is represented, or whether another implementation can decode the same data.

The build-tag statement adds another verification point. Generics and monomorphization are both supported, but the README does not explain whether those paths produce identical serialization behavior. That does not prove an incompatibility. It means an engineer must check `codec/README.md`, relevant build tags, and tests for the particular mode used by the application.

For cross-service use, the first acceptance condition should be byte-level agreement with the receiving implementation, not merely the presence of a format name. The repository's format list supports selection, while interoperability requires rules that the top-level README leaves unspecified.

Where codecgen and RPC documentation fall short

The repository contains `codecgen`, and the README states that ugorji/go supports generics and monomorphization based on build tags. Even so, it does not provide a `codecgen` command, identify its inputs or outputs, list generated files, or explain when regeneration is required. Code generation therefore cannot responsibly be included in the documented installation and first-use sequence.

RPC is a larger question. The repository description calls ugorji/go a codec and RPC library, but the top-level README does not document an RPC client, server, transport, request envelope, interface name, or runnable example. Its install command and package link point specifically to `github.com/ugorji/go/codec`. That makes codec use the only function confirmed by the displayed project overview. An application selecting ugorji/go because of its RPC role needs separate documentation for the RPC package or module before making that decision.

This distinction affects adoption. A team that needs serialization alone can focus on codec APIs and format behavior. A team considering RPC must also verify transport compatibility, public interfaces, error handling, lifecycle management, and integration examples. None of those RPC details appear in the top-level README.

Maintenance, releases, and upgrade boundaries

The repository is not archived, and its last push was on 2026-09-02. Recent tagged releases include `codec/v1.3.2` on 2026-08-04, `codec/v1.3.1` on 2025-10-28, and `codec/v1.3.0` on 2025-06-15. These dates show recent versioned repository activity, but they do not reveal compatibility guarantees or the effort required to upgrade a dependent application.

The available project overview does not include release notes, a changelog format, migration guide, Go compatibility matrix, security policy, or deprecation policy. It also does not state whether generated code must be regenerated between releases. An upgrade can therefore affect dependency management, API calls, generated files, or wire output only in ways that cannot be determined from the main README.

The project uses the MIT License. That identifier defines the repository's declared licensing terms, but engineers should review the actual `LICENSE` file when adding it to a distribution or commercial codebase. No separate license is identified for `codecgen`, benchmarks, or individual formats in the project overview.

A practical maintenance check must compare release tags, inspect `codec/README.md`, and test encoded fixtures across the version being used. Without a documented compatibility matrix, preserving old fixture bytes is more defensible than assuming that names such as MessagePack or CBOR guarantee unchanged output.

ugorji/go versus encoding/json and separate codec libraries

The Go standard library is the clearest alternative for applications that only need JSON. It keeps the JSON dependency within the Go distribution and follows the standard library's established API. ugorji/go differs by documenting support for MessagePack, CBOR, BINC, and simple format alongside JSON. That broader format coverage is relevant when one service communicates through more than one representation.

Neither the README nor its displayed benchmark summary proves that ugorji/go is faster, allocates less memory, produces smaller values, validates more strictly, or supports more Go types. The repository includes benchmarks, but no commands or results are shown in the overview. A direct comparison with `encoding/json` should use the application's actual structs, maps, byte slices, numeric values, and error cases rather than infer a general result from repository layout.

A second option is choosing separate libraries for JSON, MessagePack, and CBOR. ugorji/go may reduce the number of top-level dependencies and may offer a more consistent API, but the README does not establish feature parity across formats or show how far those APIs differ. For JSON-only services, the standard library can remain the simpler dependency. For services with confirmed MessagePack or CBOR requirements, the deciding evidence should be API documentation, interoperability behavior, and tests of the selected format.

Editorial conclusion

Go developers can adopt ugorji/go when one module must cover MessagePack, CBOR, JSON, BINC or simple encoding. Projects that need documented setup examples, explicit interoperability rules, an RPC quick start or clear migration procedures should first review `codec/README.md`, the module release notes, and the behavior of their required wire formats. The repository contains one module, `github.com/ugorji/go/codec`, uses the MIT License, and had its last push on 2026-09-02.

Frequently asked questions

How do I install ugorji/go?

Run `go get github.com/ugorji/go/codec`. The README identifies that path as the repository's single Go module.

Which serialization formats does ugorji/go support?

The README lists BINC, MessagePack, CBOR, JSON, and simple. It groups them as binary and text formats but does not provide format-specific compatibility rules.

Does ugorji/go require code generation?

The repository includes `codecgen`, and the README says ugorji/go supports generics and monomorphization based on build tags. The top-level README does not state when generation is required or provide an invocation example.

What license does ugorji/go use?

The repository identifies the MIT License in its README and includes a `LICENSE` file at the repository root.

Official sources

  1. Issues
  2. License: MIT
  3. README
  4. Releases
  5. ugorji/go on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/ugorji-go.svg)](https://hysenlabs.com/projects/ugorji-go)

Was this useful?