json

package module
v0.0.0-...-0829b1e Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 1 Imported by: 13

README

Encoding/Binary

JSON Serializer for Go

Dependency:

github.com/json-iterator/go

A high-performance 100% compatible drop-in replacement of "encoding/json"

Usage

Import the package

import (
    ...
    "github.com/paulusrobin/leaf-utilities/encoding/json"
    ...
)

To serialize a message, simply Marshal:

v := &message{
    Name:      "Roman",
    Timestamp: 1242345235,
    Payload:   []byte("hi"),
    Ssid:      []uint32{1, 2, 3},
}
encoded, err := json.Marshal(v)

To deserialize, Unmarshal:

var v message
err := json.Unmarshal(encoded, &v)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(v interface{}) ([]byte, error)

func MarshalIndent

func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error)

func MarshalToString

func MarshalToString(v interface{}) (string, error)

func SetConfig

func SetConfig(config jsoniter.Config)

func Unmarshal

func Unmarshal(data []byte, v interface{}) error

func UnmarshalFromString

func UnmarshalFromString(str string, v interface{}) error

func Valid

func Valid(data []byte) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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