json

package
v0.0.0-...-55cb7e4 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

DigiStratum GoLib - JSON

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Json

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

func NewJson

func NewJson(jsonString *string) *Json

func NewJsonFromFile

func NewJsonFromFile(path string) *Json

Make a new one of these (from file)!

func (*Json) Load

func (r *Json) Load(target interface{}) error

Generic JSON load (into ANY interface) The provided target should be a pointer to where we will dump the decoded JSON result

func (*Json) ToDataValue

func (r *Json) ToDataValue() (*data.DataValue, error)

Convert the Json source to a dynamic DataValue

type JsonDeserializableIfc

type JsonDeserializableIfc interface {
	FromJson(jsonString *string) error
}

type JsonIfc

type JsonIfc interface {
	Load(target interface{}) error
	ToDataValue() (*data.DataValue, error)
}

type JsonSerializableIfc

type JsonSerializableIfc interface {
	ToJson() (*string, error)
}

Our own take on JsonSerializable.

Note that this is a weak substitute/attempt to "normalize" JSON support for our own library when we have these available from Go built-in packages:

MarshalJSON() ([]byte, error) // Equivalent of JsonSerializableIfc UnmarshalJSON(value []byte) error // Equivalent of JsonDeserializableIfc

The only difference, really, is []byte vs *string. If we want to seriously support reorienting around strings, then we probably need to support some sort of reflection/deep recursion mechanism that will traverse the structures received properly as with Un|MarshallJSON

Jump to

Keyboard shortcuts

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