Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.2% on proxy.golang.org

proxy.golang.org : github.com/nofeaturesonlybugs/jsmu

Package jsmu abstracts the typical 2-pass JSON encoding into what looks like a 1-pass JSON encoding step when marshalling or unmarshalling data. Pronounce as j◦s◦mew. Writing a general purpose JSON unmarshaller usually requires the following steps: Writing a general purpose JSON marshaller works in reverse: jsmu simply abstracts the above logic into a single marshal or unmarshal call as necessary and alleviates you from having to maintain large type switches, constructor tables, or whatever other mechanism you perform the above logic with. jsmu requires that ConcreteType(s) be registered along with their TypeName and supports two conventions for supplying the TypeName. You can embed a TypeName field directly into your struct: Or you can pass a TypeName value during the call to Register(): Applications want to send messages. In order for an endpoint to unpack an arbitrary message into a concrete type we need to send type information along with the message (this was referred to as TypeName above). In other words the most basic message format becomes: Conceptually we can think of this type wrapped around the "message" as the envelope. jsmu allows you to use any custom type as an envelope by exposing and expecting the Enveloper interface: If you leave the EnveloperFn field as nil then DefaultEnveloperFunc is used and your JSON needs to conform to the structure defined by Envelope.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/nofeaturesonlybugs/jsmu
Keywords: go, gob, golang, json, marshaller, marshalling
License: MIT
Latest release: almost 2 years ago
First release: almost 3 years ago
Namespace: github.com/nofeaturesonlybugs
Stars: 3 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 3 days ago

    Loading...
    Readme
    Loading...