Ecosyste.ms: Packages

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

Top 2.2% on proxy.golang.org
Top 0.4% dependent packages on proxy.golang.org
Top 0.5% dependent repos on proxy.golang.org
Top 5.2% forks on proxy.golang.org
Top 0.7% docker downloads on proxy.golang.org

proxy.golang.org : github.com/icza/dyno

Package dyno is a utility to work with dynamic objects at ease. Primary goal is to easily handle dynamic objects and arrays (and a mixture of these) that are the result of unmarshaling a JSON or YAML text into an interface{} for example. When unmarshaling into interface{}, libraries usually choose either map[string]interface{} or map[interface{}]interface{} to represent objects, and []interface{} to represent arrays. Package dyno supports a mixture of these in any depth and combination. When operating on a dynamic object, you designate a value you're interested in by specifying a path. A path is a navigation; it is a series of map keys and int slice indices that tells how to get to the value. Should you need to marshal a dynamic object to JSON which contains maps with interface{} key type (which is not supported by encoding/json), you may use the ConvertMapI2MapS converter function. The implementation does not use reflection at all, so performance is rather good. Let's see a simple example editing a JSON text to mask out a password. This is a simplified version of the Example_jsonEdit example function: Output will be: Example shows a few of dyno's features, such as getting, setting and appending values to / from a dynamic object. Example_jsonEdit shows a simple example how JSON can be edited. The password placed in the JSON is masked out.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/icza/dyno
Keywords: array, dictionary, dynamic-objects, map, path, slice
License: Apache-2.0
Latest release: about 1 year ago
First release: over 4 years ago
Namespace: github.com/icza
Dependent packages: 134
Dependent repositories: 123
Stars: 119 on GitHub
Forks: 18 on GitHub
Docker dependents: 31
Docker downloads: 7,750,204
See more repository details: repos.ecosyste.ms
Funding links: https://github.com/sponsors/icza
Last synced: 3 days ago

    Loading...
    Readme
    Loading...