gg_json

package
v0.2.88 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONHelper

type JSONHelper struct {
}
var JSON *JSONHelper

func (*JSONHelper) Bytes

func (instance *JSONHelper) Bytes(entity interface{}) []byte

func (*JSONHelper) BytesToArray

func (instance *JSONHelper) BytesToArray(data []byte) ([]interface{}, bool)

func (*JSONHelper) BytesToMap

func (instance *JSONHelper) BytesToMap(data []byte) (map[string]interface{}, bool)

func (*JSONHelper) IsDelimitedJson

func (instance *JSONHelper) IsDelimitedJson(s string) bool

func (*JSONHelper) IsValidJson

func (instance *JSONHelper) IsValidJson(text string) bool

func (*JSONHelper) IsValidJsonArray

func (instance *JSONHelper) IsValidJsonArray(text string) bool

func (*JSONHelper) IsValidJsonObject

func (instance *JSONHelper) IsValidJsonObject(text string) bool

func (*JSONHelper) Parse

func (instance *JSONHelper) Parse(input interface{}) interface{}

func (*JSONHelper) Read

func (instance *JSONHelper) Read(input interface{}, entity interface{}) (err error)

Read Support inputs like maps, strings and byte arrays.

func (*JSONHelper) ReadArrayFromFile

func (instance *JSONHelper) ReadArrayFromFile(fileName string) ([]map[string]interface{}, error)

func (*JSONHelper) ReadFromFile

func (instance *JSONHelper) ReadFromFile(fileName string, entity interface{}) error

func (*JSONHelper) ReadMapFromFile

func (instance *JSONHelper) ReadMapFromFile(fileName string) (map[string]interface{}, error)

func (*JSONHelper) StringToArray

func (instance *JSONHelper) StringToArray(text string) ([]interface{}, bool)

func (*JSONHelper) StringToMap

func (instance *JSONHelper) StringToMap(text string) (map[string]interface{}, bool)

func (*JSONHelper) Stringify

func (instance *JSONHelper) Stringify(entity interface{}) string

func (*JSONHelper) TextExtractor

func (instance *JSONHelper) TextExtractor(input interface{}) *JsonExtractor

func (*JSONHelper) Wrap

func (instance *JSONHelper) Wrap(input interface{}) *JSONWrap

type JSONWrap

type JSONWrap struct {
	// contains filtered or unexported fields
}

JSONWrap simple wrapper for JSON objects

func NewJSONWrap

func NewJSONWrap(value interface{}) (instance *JSONWrap)

func (*JSONWrap) Array

func (instance *JSONWrap) Array() []map[string]interface{}

func (*JSONWrap) AsArray

func (instance *JSONWrap) AsArray() (response []map[string]interface{}, err error)

func (*JSONWrap) AsMap

func (instance *JSONWrap) AsMap() (response map[string]interface{}, err error)

func (*JSONWrap) Error

func (instance *JSONWrap) Error() error

func (*JSONWrap) HasError

func (instance *JSONWrap) HasError() bool

func (*JSONWrap) IsArray

func (instance *JSONWrap) IsArray() bool

func (*JSONWrap) IsMap

func (instance *JSONWrap) IsMap() bool

func (*JSONWrap) IsUnknown

func (instance *JSONWrap) IsUnknown() bool

func (*JSONWrap) Kind

func (instance *JSONWrap) Kind() string

func (*JSONWrap) KindRt

func (instance *JSONWrap) KindRt() reflect.Kind

func (*JSONWrap) Map

func (instance *JSONWrap) Map() map[string]interface{}

func (*JSONWrap) String

func (instance *JSONWrap) String() string

func (*JSONWrap) Value

func (instance *JSONWrap) Value() interface{}

type JsonExtractor

type JsonExtractor struct {
	// contains filtered or unexported fields
}

JsonExtractor extract json objects from a text file or from long text

func NewJsonExtractor

func NewJsonExtractor() (instance *JsonExtractor)

func (*JsonExtractor) Get

func (instance *JsonExtractor) Get() (response interface{})

Get parse a text to detect and extract all JSON objects or arrays found. Returns an object or an array of objects or arrays

func (*JsonExtractor) GetObjects

func (instance *JsonExtractor) GetObjects() (response []*JSONWrap, err error)

func (*JsonExtractor) LoadFromFile

func (instance *JsonExtractor) LoadFromFile(filename string) *JsonExtractor

func (*JsonExtractor) String

func (instance *JsonExtractor) String() string

func (*JsonExtractor) Write

func (instance *JsonExtractor) Write(value interface{}) *JsonExtractor

Jump to

Keyboard shortcuts

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