Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bytedance/json
JSON standard package extension library
https://github.com/bytedance/json
json
Last synced: 2 months ago
JSON representation
JSON standard package extension library
- Host: GitHub
- URL: https://github.com/bytedance/json
- Owner: bytedance
- License: bsd-3-clause
- Created: 2018-11-07T09:10:12.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-16T03:27:18.000Z (over 5 years ago)
- Last Synced: 2024-06-19T03:01:46.529Z (7 months ago)
- Topics: json
- Language: Go
- Homepage:
- Size: 184 KB
- Stars: 32
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# json
JSON standard package extension library.
## Extension feature
1. In the case of a non-cyclic combination, using zero value('[]' or '{}') instead of null.
```go
func ExampleMarshalNotnull() {
var a *A
b, _ := json.Marshal(a)
fmt.Println(string(b))
// Output:
// {"List":[],"Map":{},"Children":[],"B":{"ListB":null,"MapB":null,"A":null,"B":null},"MapPtr":{}}
}type A struct {
List []string
Map map[string]string
Children []*A
B *B
MapPtr *map[string]string
}type B struct {
ListB []string
MapB map[string]string
A *A
B *B
}
```