• Stars
    star
    19
  • Rank 1,163,249 (Top 23 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Go MapSlice for ordered marshal/ unmarshal of maps in JSON

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)
}

More Repositories

1

etcdtool

Export/Import/Edit etcd directory as JSON/YAML/TOML and validate directory using JSON schema
Go
171
star
2

docker-build-ami

Build Amazon EC2 AMI image using a Dockerfile
Python
68
star
3

pepa

Configuration templating for SaltStack using Hierarchical substitution and Jinja.
Python
14
star
4

tf

Template files in Bash using YAML/JSON/TOML or Etcd input and GO text template
Go
10
star
5

encoding

Go package provides a generic interface to encoders and decoders
Go
9
star
6

distill

Template engine using hierarchical substitution for Puppet through the ENC interface
Perl
7
star
7

etcdmap

Go package provides methods for interacting with Etcd using struct, map or JSON
Go
7
star
8

netlink

Netlink Go package for listening to interface events and getting extended flags such as IFF_RUNNING.
Go
6
star
9

go-sff

Go decoder for SFP/QSFP Eeprom modules based on SFF-8079 and SFF-8636
Go
5
star
10

peekaboo

Micro-service for exposing system and hardware information
Go
4
star
11

compress

Package provides a generic interface to compress and un-compress
Go
4
star
12

grpc-exec-example

gRPC remote exec example
Go
3
star
13

osquery-protobuf

osquery database schemas converted to protobuf
Go
3
star
14

jsonptr

Go implementation of JSON pointer
Go
2
star
15

auth

Package provides JWT using public keys and a generic interface to authentication such as LDAP
Go
2
star
16

go-workday

Workday client written in Go
Go
2
star
17

typeconv

Provides conversion from a string to specific Go type
Go
2
star
18

typecomp

Provides comparison for different Go types and a Comparer interface when using structs
Go
1
star