jsonframer

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: Apache-2.0, MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidRootSelector = errors.New("failed to compile JSONata expression")
	ErrEvaluatingJSONata   = errors.New("error evaluating JSONata expression")
	ErrInvalidJSONContent  = errors.New("invalid/empty JSON")
	ErrInvalidJQSelector   = errors.New("failed to compile jq selector")
	ErrUnMarshalingJSON    = errors.New("error while un-marshaling json")
	ErrMarshalingJSON      = errors.New("error while marshaling json")
	ErrExecutingJQ         = errors.New("error while executing JQ")
)

Functions

func GetRootData

func GetRootData(jsonString string, rootSelector string, framerType FramerType) (string, error)

func ToFrame

func ToFrame(jsonString string, options FramerOptions) (frame *data.Frame, err error)

func ToFrames

func ToFrames(jsonString string, options FramerOptions) (frames []*data.Frame, err error)

Types

type ColumnSelector

type ColumnSelector struct {
	Selector   string
	Alias      string
	Type       string
	TimeFormat string
}

type FrameFormat

type FrameFormat string
const (
	FrameFormatTable      FrameFormat = "table"
	FrameFormatTimeSeries FrameFormat = "timeseries"
	FrameFormatNumeric    FrameFormat = "numeric"
)

type FramerOptions

type FramerOptions struct {
	FramerType      FramerType // `gjson` | `jsonata` | `jq`
	FrameName       string
	RootSelector    string
	Columns         []ColumnSelector
	OverrideColumns []ColumnSelector
	FrameFormat     FrameFormat
}

type FramerType

type FramerType string
const (
	FramerTypeGJSON   FramerType = "gjson"
	FramerTypeJsonata FramerType = "jsonata"
	FramerTypeJQ      FramerType = "jq"
)

Jump to

Keyboard shortcuts

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