Refers
- JSON and Go https://blog.golang.org/json-and-go
- Go-Ordered-JSON https://github.com/virtuald/go-ordered-json from this thread Preserving key order in encoding/json and the Abandoned 7930: encoding/json: Optionally preserve the key order of JSON objects
- Python OrderedDict https://github.com/python/cpython/blob/2.7/Lib/collections.py#L38
the Python's OrderedDict uses a double linked list internally, maintain a consistent public interface with
dict
Disclaimer:
same as Go's default map, this OrderedMap is not safe for concurrent use, if need atomic access, may use a sync.Mutex to synchronize.