All Projects → bytedance → json

bytedance / json

Licence: BSD-3-Clause License
JSON standard package extension library

Programming Languages

go
31211 projects - #10 most used programming language

Labels

json

JSON standard package extension library.

Extension feature

  1. In the case of a non-cyclic combination, using zero value('[]' or '{}') instead of null.
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
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].