8000 GitHub - cloudfoundry/jsonry at v1.1.3
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cloudfoundry/jsonry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 8000  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

test go.dev reference

JSONry

A Go library and notation for converting between a Go struct and JSON.

import "code.cloudfoundry.org/jsonry"

s := struct {
  GUID string `jsonry:"relationships.space.data.guid"`
}{
  GUID: "267758c0-985b-11ea-b9ac-48bf6bec2d78",
}

json, _ := jsonry.
7968
Marshal(s)
fmt.Println(string(json))

Will generate the following JSON:

{
  "relationships": {
    "space": {
      "data": {
        "guid": "267758c0-985b-11ea-b9ac-48bf6bec2d78"
      }
    }
  }
}

The operation is reversible using Unmarshal(). The key advantage is that nested JSON can be generated and parsed without the need to create intermediate Go structures. Check out the documentation for details.

JSONry started life in the Cloud Foundry CLI project. It has been extracted so that it can be used in other projects too.

More information:

About

A Go library and notation for converting between a Go struct and JSON

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 6

0