json

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

README

References

Documentation

Overview

Package json the json parser

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct{}

Parser the json parser

func (Parser) GetElement

func (p Parser) GetElement(ctx *plugin.Context, content any, arg string) (string, error)

GetElement gets the element of the content with the given arguments. sames as the GetString.

func (Parser) GetElements

func (p Parser) GetElements(ctx *plugin.Context, content any, arg string) ([]string, error)

GetElements gets the elements of the content with the given arguments. sames as the GetStrings.

func (Parser) GetString

func (p Parser) GetString(_ *plugin.Context, content any, arg string) (string, error)

GetString gets the string of the content with the given arguments.

content := `{"keys": [{"key":"foo"},{"key":"bar"}]}` GetString(ctx, content, "$.key[*].key") returns "foo\nbar"

func (Parser) GetStrings

func (p Parser) GetStrings(_ *plugin.Context, content any, arg string) ([]string, error)

GetStrings gets the strings of the content with the given arguments.

content := `{"keys": [{"key":"foo"},{"key":"bar"}]}` GetStrings(ctx, content, "$.key[*].key") returns []string{"foo", "bar"}

Jump to

Keyboard shortcuts

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