xjson

package module
v0.0.0-...-4986731 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2022 License: BSD-3-Clause Imports: 2 Imported by: 1

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

Overview

Package xjson implements JSON helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalIndent

func MarshalIndent(v interface{}) string

MarshalIndent is like json.MarshalIndent but correctly indents the resulting JSON. And does not return an error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL