https://github.com/cornelk/orderedmap
A Golang Map that keeps track of the insert order of items.
https://github.com/cornelk/orderedmap
go golang hashmap map orderedmap
Last synced: 3 months ago
JSON representation
A Golang Map that keeps track of the insert order of items.
- Host: GitHub
- URL: https://github.com/cornelk/orderedmap
- Owner: cornelk
- License: apache-2.0
- Created: 2022-08-29T00:29:04.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-08-29T02:00:46.000Z (almost 3 years ago)
- Last Synced: 2025-02-01T05:45:25.721Z (5 months ago)
- Topics: go, golang, hashmap, map, orderedmap
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# orderedmap
[](https://github.com/cornelk/orderedmap/actions)
[](https://pkg.go.dev/github.com/cornelk/orderedmap)
[](https://goreportcard.com/report/github.com/cornelk/orderedmap)
[](https://codecov.io/gh/cornelk/orderedmap)## Overview
A Golang Map that keeps track of the insert order of items.
The current version can be used as a replacement for `map[string]interface{}` and allows JSON unmarshalling into it.
No manual adding of items is currently possible.## Usage
Unmarshall and marshall JSON:
```
var m Map
input := `{"423":"abc","231":"dbh","152":"xyz"}`m.UnmarshalJSON([]byte(input))
output, _ := m.MarshalJSON()
# unlike the standard Golang map, the output will be exact the same and not in random key order
```