Registry / serialization / nspcc-dev-go-ordered-json

nspcc-dev-go-ordered-json

JSON →
library0.0.0-20240112074137-296698a162aegogounverified

A Go library for encoding and decoding JSON while preserving key order.

go get github.com/nspcc-dev/go-ordered-json
INSTALL
IMPORT
SIG · NSPCC-DEV-GO-ORDER
N
nspcc-dev-go-ordered-json
serializationgov0.0.0-20240112074137-296698a162ae
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

json
github.com/nspcc-dev/go-ordered-json

Marshals JSON with keys in insertion order.

package main import ( "fmt" "github.com/nspcc-dev/go-ordered-json" ) func main() { var data json.OrderedObject data = append(data, json.KV{Key: "b", Value: 2}) data = append(data, json.KV{Key: "a", Value: 1}) b, _ := json.Marshal(data) fmt.Println(string(b)) }
Debug
Known issues
gotchaThis package shadows the standard library 'encoding/json' package name.
fix
Use an import alias if both are needed.
affects: *
Upgrade
Version history
0.0.0-20240112074137-296698a162aelatest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
nspcc-dev-go-ordered-json — go get nspcc-dev-go-ordered-json · libregistry