Skip to content

Latest commit

 

History

History

json

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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)