jsonutil

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 18, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToXML

func ConvertToXML(jsonStr string, newOpts ...ConvertToXMLOption) (string, error)

ConvertToXML converts json to xml

func LoadFile

func LoadFile(file string, v interface{}) error

LoadFile loads json object from file

func LoadReader

func LoadReader(reader io.Reader, v interface{}) error

LoadReader loads json object from reader

func SaveFile

func SaveFile(file string, v interface{}) error

SaveFile saves json object to a file

func SaveFileIndent

func SaveFileIndent(file string, v interface{}, prefix, indent string) error

SaveFileIndent saves json object to a file with indent

func SaveWriter

func SaveWriter(writer io.Writer, v interface{}) error

SaveWriter saves json object to a writer

func SaveWriterIndent

func SaveWriterIndent(writer io.Writer, v interface{}, prefix, indent string) error

SaveWriterIndent save json object to a writer with indent

Types

type ConvertToXMLOption

type ConvertToXMLOption func(*ConvertToXMLOptions) error

ConvertToXMLOption is a function on the options for a json2xml.

func WithIndent

func WithIndent(withIndent bool, prefix, indent string) ConvertToXMLOption

WithIndent ...

func WithRootElementName

func WithRootElementName(name string) ConvertToXMLOption

WithRootElementName ...

type ConvertToXMLOptions

type ConvertToXMLOptions struct {
	WithIndent      bool   // well formatted json
	Prefix          string // the json marshal prefix
	Indent          string // the json marshal indent
	RootElementName string // the json root tag
}

ConvertToXMLOptions ...

func DefaultConvertToXMLOptions

func DefaultConvertToXMLOptions() *ConvertToXMLOptions

DefaultConvertToXMLOptions ...

Jump to

Keyboard shortcuts

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