j2x

package
v0.0.0-...-63df579 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: BSD-3-Clause, MIT Imports: 2 Imported by: 0

Documentation

Overview

j2x.go - For (mostly) backwards compatibility with legacy j2x package. Wrappers for end-to-end JSON to XML transformation and value manipulation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonLeafNodes

func JsonLeafNodes(jsonVal []byte) ([]LeafNode, error)

Wrap LeafNodes for JSON. 'jsonVal' is an JSON value

func JsonLeafPath

func JsonLeafPath(jsonVal []byte) ([]string, error)

Wrap LeafPath for JSON. 'xmlVal' is an JSON value

func JsonLeafValues

func JsonLeafValues(jsonVal []byte) ([]interface{}, error)

Wrap LeafValues for JSON. 'jsonVal' is an JSON value

func JsonNewJson

func JsonNewJson(jsonVal []byte, keypairs ...string) ([]byte, error)

Wrap NewMap for JSON and return as JSON 'jsonVal' is an JSON value 'keypairs' are "oldKey:newKey" values that conform to 'keypairs' in (Map)NewMap.

func JsonNewXml

func JsonNewXml(jsonVal []byte, keypairs ...string) ([]byte, error)

Wrap NewMap for JSON and return as XML 'jsonVal' is an JSON value 'keypairs' are "oldKey:newKey" values that conform to 'keypairs' in (Map)NewMap.

func JsonPathForKeyShortest

func JsonPathForKeyShortest(jsonVal []byte, key string) (string, error)

Wrap PathForKeyShortest for JSON.

func JsonPathsForKey

func JsonPathsForKey(jsonVal []byte, key string) ([]string, error)

Wrap PathsForKey for JSON.

func JsonReaderToXml

func JsonReaderToXml(jsonReader io.Reader) ([]byte, []byte, error)

FromJsonReader() --> ToXml().

func JsonReaderToXmlWriter

func JsonReaderToXmlWriter(jsonReader io.Reader, xmlWriter io.Writer) ([]byte, []byte, error)

FromJsonReader() --> ToXmlWriter(). Handy for transforming bulk message sets.

func JsonToMap

func JsonToMap(jsonVal []byte) (map[string]interface{}, error)

FromJson() --> map[string]interface{}

func JsonToXml

func JsonToXml(jsonVal []byte) ([]byte, error)

FromJson() --> ToXml().

func JsonToXmlWriter

func JsonToXmlWriter(jsonVal []byte, xmlWriter io.Writer) ([]byte, error)

FromJson() --> ToXmlWriter().

func JsonUpdateValsForPath

func JsonUpdateValsForPath(jsonVal []byte, newKeyValue interface{}, path string, subkeys ...string) ([]byte, error)

Wrap UpdateValuesForPath for JSON

'jsonVal' is XML value
'newKeyValue' is the value to replace an existing value at the end of 'path'
'path' is the dot-notation path with the key whose value is to be replaced at the end
       (can include wildcard character, '*')
'subkeys' are key:value pairs of key:values that must match for the key

func JsonValuesForKey

func JsonValuesForKey(jsonVal []byte, key string, subkeys ...string) ([]interface{}, error)

Wrap ValuesForKey for JSON.

func JsonValuesForKeyPath

func JsonValuesForKeyPath(jsonVal []byte, path string, subkeys ...string) ([]interface{}, error)

Wrap ValuesForKeyPath for JSON.

func MapToJson

func MapToJson(m map[string]interface{}, safeEncoding ...bool) ([]byte, error)

interface{} --> ToJson (w/o safe encoding, default) {

Types

This section is empty.

Jump to

Keyboard shortcuts

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