orderedjson

package
v1.4.78 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONString

func JSONString(j OJsonObject) string

JSONString returns a formatted string representation of an ordered JSON

Types

type OJsonBool

type OJsonBool bool

OJsonBool is a JSON bool value.

type OJsonKeyValuePair

type OJsonKeyValuePair struct {
	Key   string
	Value OJsonObject
}

OJsonKeyValuePair is a key-value pair in a JSON map. Since this is ordered JSON, maps are really ordered lists of key value pairs.

type OJsonList

type OJsonList []OJsonObject

OJsonList is a JSON list.

func (*OJsonList) AsList

func (j *OJsonList) AsList() []OJsonObject

AsList converts a JSON list to a slice of objects.

type OJsonMap

type OJsonMap struct {
	KeySet    map[string]bool
	OrderedKV []*OJsonKeyValuePair
}

OJsonMap is an ordered map, actually a list of key value pairs.

func NewMap

func NewMap() *OJsonMap

NewMap is a create new ordered "map" instance.

func (*OJsonMap) KeyValuePairsSortedByKey

func (j *OJsonMap) KeyValuePairsSortedByKey() []*OJsonKeyValuePair

KeyValuePairsSortedByKey returns the list of key-value pairs sorted by key.

func (*OJsonMap) Put

func (j *OJsonMap) Put(key string, value OJsonObject)

Put puts into map. Does nothing if key exists in map.

func (*OJsonMap) RefreshKeySet

func (j *OJsonMap) RefreshKeySet()

RefreshKeySet recreates the key set from the key value pairs.

func (*OJsonMap) Size

func (j *OJsonMap) Size() int

Size yields the size of ordered map.

type OJsonObject

type OJsonObject interface {
	// contains filtered or unexported methods
}

OJsonObject is an ordered JSON tree object interface.

func ParseOrderedJSON

func ParseOrderedJSON(input []byte) (OJsonObject, error)

ParseOrderedJSON parses JSON preserving order in maps

type OJsonString

type OJsonString struct {
	Value string
}

OJsonString is a JSON string value.

Jump to

Keyboard shortcuts

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