- Adds/Refactors methods for Set, Merge, Filter, Delete - Renames expr/Vars.Merge to MustMerge, updates its usage - Appends kvFunctions to parser in pkg/expr - Update/Fixes tests and example testable
19 lines
318 B
Go
19 lines
318 B
Go
package expr
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/PaesslerAG/gval"
|
|
)
|
|
|
|
func JsonFunctions() []gval.Language {
|
|
return []gval.Language{
|
|
// TODO: Json decoding, parsing, stringify, JQ, JSONPath
|
|
gval.Function("toJSON", toJSON),
|
|
}
|
|
}
|
|
|
|
func toJSON(f interface{}) string {
|
|
b, _ := json.Marshal(f)
|
|
return string(b)
|
|
}
|