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 ¶
- func JsonLeafNodes(jsonVal []byte) ([]LeafNode, error)
- func JsonLeafPath(jsonVal []byte) ([]string, error)
- func JsonLeafValues(jsonVal []byte) ([]interface{}, error)
- func JsonNewJson(jsonVal []byte, keypairs ...string) ([]byte, error)
- func JsonNewXml(jsonVal []byte, keypairs ...string) ([]byte, error)
- func JsonPathForKeyShortest(jsonVal []byte, key string) (string, error)
- func JsonPathsForKey(jsonVal []byte, key string) ([]string, error)
- func JsonReaderToXml(jsonReader io.Reader) ([]byte, []byte, error)
- func JsonReaderToXmlWriter(jsonReader io.Reader, xmlWriter io.Writer) ([]byte, []byte, error)
- func JsonToMap(jsonVal []byte) (map[string]interface{}, error)
- func JsonToXml(jsonVal []byte) ([]byte, error)
- func JsonToXmlWriter(jsonVal []byte, xmlWriter io.Writer) ([]byte, error)
- func JsonUpdateValsForPath(jsonVal []byte, newKeyValue interface{}, path string, subkeys ...string) ([]byte, error)
- func JsonValuesForKey(jsonVal []byte, key string, subkeys ...string) ([]interface{}, error)
- func JsonValuesForKeyPath(jsonVal []byte, path string, subkeys ...string) ([]interface{}, error)
- func MapToJson(m map[string]interface{}, safeEncoding ...bool) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JsonLeafNodes ¶
Wrap LeafNodes for JSON. 'jsonVal' is an JSON value
func JsonLeafPath ¶
Wrap LeafPath for JSON. 'xmlVal' is an JSON value
func JsonLeafValues ¶
Wrap LeafValues for JSON. 'jsonVal' is an JSON value
func JsonNewJson ¶
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 ¶
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 ¶
Wrap PathForKeyShortest for JSON.
func JsonPathsForKey ¶
Wrap PathsForKey for JSON.
func JsonReaderToXml ¶
FromJsonReader() --> ToXml().
func JsonReaderToXmlWriter ¶
FromJsonReader() --> ToXmlWriter(). Handy for transforming bulk message sets.
func JsonToXmlWriter ¶
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 ¶
Wrap ValuesForKey for JSON.
func JsonValuesForKeyPath ¶
Wrap ValuesForKeyPath for JSON.
Types ¶
This section is empty.