package
module
Version:
v0.0.0-...-4986731
Opens a new window with list of versions in this module.
Published: Oct 18, 2022
License: BSD-3-Clause
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
¶
xjson
xjson implements JSON helpers.
Install
go get oss.terrastruct.com/xjson
Usage
type YourData struct {
Nested YourNestedData `json:"nested"`
}
type YourNestedData struct {
A int `json:"a"`
}
data := YourData{
Nested: YourNestedData{
A: 5
}
}
// Nicely indented JSON printout
//
//{
// "nested": {
// "a": 5
// }
//}
println(xjson.MarshalIndent(data))
Documentation
¶
Package xjson implements JSON helpers.
func MarshalIndent(v interface{}) string
MarshalIndent is like json.MarshalIndent but correctly indents the resulting JSON.
And does not return an error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.