Skip to content

Commit

Permalink
Readme should reference documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
blgm committed May 18, 2020
1 parent 827f364 commit e2ce1fd
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,33 @@
[![CI](https://github.com/cloudfoundry/jsonry/workflows/Go/badge.svg)](https://github.com/cloudfoundry/jsonry/actions?query=workflow%3AGo)
[![GoDoc](https://godoc.org/code.cloudfoundry.org/jsonry?status.png)](https://godoc.org/code.cloudfoundry.org/jsonry)
# JSONry

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

JSONry is being extracted from the [Cloud Foundry CLI](https://github.com/cloudfoundry/cli) project. It exists to make it easier
to define the translation between complex JSON data and Go structures.
```go
s := struct {
GUID string `jsonry:"relationships.space.data.guid"`
}{
GUID: "267758c0-985b-11ea-b9ac-48bf6bec2d78",
}

json, _ := jsonry.Marshal(s)
fmt.Println(string(json))
```
Will generate the following JSON:
```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](https://godoc.org/code.cloudfoundry.org/jsonry) for details.

JSONry started life in the [Cloud Foundry CLI](https://github.com/cloudfoundry/cli) project. It has been extracted so
that it can be used in other projects too.

0 comments on commit e2ce1fd

Please sign in to comment.