jsonutils

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractValue

func ExtractValue(obj *fastjson.Value, lookup ...string) *fastjson.Value

ExtractValue looks up the JSON value identified by object property names in `lookup` (the same as `LookupValue`), and then *removes* that property from the object. If removing that property results in any empty object, then that object is removed as well -- except the top-level object is not changed to nil.

func ExtractValueOfType

func ExtractValueOfType(obj *fastjson.Value, typ fastjson.Type, lookup ...string) *fastjson.Value

ExtractValueOfType is a version of ExtractValue that only considers the value a match if it is of the given type.

func LookupValue

func LookupValue(obj *fastjson.Value, lookup ...string) *fastjson.Value

LookupValue looks up the JSON value identified by object property names in `lookup`.

ECS allows a field "foo.bar" to be dotted:

{"foo.bar": 42}

or undotted:

{foo": {"bar": 43}}

Assumption: There are no conflicts. E.g. we don't have:

obj:    {"foo.bar": 42, "foo": {"bar": 43}}
lookup: [foo, bar]

In this case, the result is unspecified. *One* of the paths will win.

Types

This section is empty.

Jump to

Keyboard shortcuts

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