https://github.com/darylnwk/flatten
Go library for flattening structs with JSON tags
https://github.com/darylnwk/flatten
flattened-json golang json
Last synced: 6 months ago
JSON representation
Go library for flattening structs with JSON tags
- Host: GitHub
- URL: https://github.com/darylnwk/flatten
- Owner: darylnwk
- License: mit
- Created: 2020-03-06T10:20:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-02T08:14:51.000Z (over 6 years ago)
- Last Synced: 2024-06-20T05:05:10.000Z (about 2 years ago)
- Topics: flattened-json, golang, json
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flatten
--
import "github.com/darylnwk/flatten"
## Usage
```go
var TimeFormat = time.RFC3339Nano
```
TimeFormat defines default time format when unmarshalling time.Time
Override this to unmarshal time.Time to a different format
#### func Struct
```go
func Struct(s interface{}, m map[string]interface{})
```
Struct parses a struct `s` with JSON tags and flattens nested parameters to only
one level and passes the result to `m`.