Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - ake-persson/mapslice-json: Go MapSlice for ordered marshal/ unmarshal of maps in JSON

Go MapSlice for ordered marshal/ unmarshal of maps in JSON - ake-persson/mapslice-json

Visit SiteGitHub - ake-persson/mapslice-json: Go MapSlice for ordered marshal/ unmarshal of maps in JSON

GitHub - ake-persson/mapslice-json: Go MapSlice for ordered marshal/ unmarshal of maps in JSON

Go MapSlice for ordered marshal/ unmarshal of maps in JSON - ake-persson/mapslice-json

Powered by 0x5a.live ๐Ÿ’—

GoDoc Go Report Card License Coverage Status Build Status

mapslice-json

Go MapSlice for ordered marshal/ unmarshal of maps in JSON

Example

package main

import (
	"encoding/json"
	"fmt"
	"log"

	"github.com/ake-persson/mapslice-json"
)

func main() {
	ms := mapslice.MapSlice{
		mapslice.MapItem{Key: "abc", Value: 123},
		mapslice.MapItem{Key: "def", Value: 456},
		mapslice.MapItem{Key: "ghi", Value: 789},
	}

	b, err := json.Marshal(ms)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(string(b))

	ms = mapslice.MapSlice{}
	if err := json.Unmarshal(b, &ms); err != nil {
		log.Fatal(err)
	}

	fmt.Println(ms)
}

GoLang Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.